Move parts of wpa_cli to a new common file