group->callback = callback;
group->userdata = userdata;
group->state = AVAHI_ENTRY_GROUP_UNCOMMITED;
+ group->path = NULL;
AVAHI_LLIST_PREPEND(AvahiEntryGroup, groups, client->groups, group);
if (!(message = dbus_message_new_method_call(
goto fail;
}
-
if (retrieve_state(group) < 0)
goto fail;
}
static int entry_group_simple_method_call(AvahiEntryGroup *group, const char *method) {
- DBusMessage *message, *reply;
+ DBusMessage *message = NULL, *reply = NULL;
DBusError error;
int r = AVAHI_OK;
AvahiClient *client;
assert(group);
client = group->client;
+ if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED)
+ return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
+
dbus_error_init(&error);
if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "IsEmpty"))) {
int reverse = 0, r = AVAHI_OK;
DBusError error;
AvahiClient *client;
+ int32_t i_interface, i_protocol;
assert(group);
assert(name);
client = group->client;
+ if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED)
+ return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
+
+ if (!domain)
+ domain = "";
+
+ if (!host)
+ host = "";
+
dbus_error_init(&error);
if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddService"))) {
goto fail;
}
+ i_interface = (int32_t) interface;
+ i_protocol = (int32_t) protocol;
+
if (!dbus_message_append_args(
message,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
+ DBUS_TYPE_INT32, &i_interface,
+ DBUS_TYPE_INT32, &i_protocol,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_STRING, &type,
DBUS_TYPE_STRING, &domain,
return r;
}
-const char* avahi_entry_group_get_dbus_path(AvahiEntryGroup *group) {
- assert(group);
-
- return group->path;
-}