summaryrefslogtreecommitdiffstats
path: root/avahi-client
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-10-11 01:24:04 +0000
committerLennart Poettering <lennart@poettering.net>2005-10-11 01:24:04 +0000
commitb49d175f13f77dfb4de0367cae9ac4b12dbec32e (patch)
tree954afc8bf27811100d3d63eb36619e24141b122d /avahi-client
parentb0234b6c3675ecfd078d283a9c854d5996d01139 (diff)
add client side wrapping of EntryGroup.AddServiceSubtype
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@721 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-client')
-rw-r--r--avahi-client/client.h11
-rw-r--r--avahi-client/entrygroup.c88
2 files changed, 99 insertions, 0 deletions
diff --git a/avahi-client/client.h b/avahi-client/client.h
index 31997cf..bad0789 100644
--- a/avahi-client/client.h
+++ b/avahi-client/client.h
@@ -219,6 +219,17 @@ int avahi_entry_group_add_service_va(
uint16_t port,
va_list va);
+/** Add a subtype for a service */
+int avahi_entry_group_add_service_subtype(
+ AvahiEntryGroup *group,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ AvahiPublishFlags flags,
+ const char *name,
+ const char *type,
+ const char *domain,
+ const char *subtype);
+
/** Browse for domains on the local network */
AvahiDomainBrowser* avahi_domain_browser_new (
AvahiClient *client,
diff --git a/avahi-client/entrygroup.c b/avahi-client/entrygroup.c
index 2dffcf6..d2526e0 100644
--- a/avahi-client/entrygroup.c
+++ b/avahi-client/entrygroup.c
@@ -507,3 +507,91 @@ int avahi_entry_group_add_service_va(
return r;
}
+int avahi_entry_group_add_service_subtype(
+ AvahiEntryGroup *group,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ AvahiPublishFlags flags,
+ const char *name,
+ const char *type,
+ const char *domain,
+ const char *subtype) {
+
+ DBusMessage *message = NULL, *reply = NULL;
+ int r = AVAHI_OK;
+ DBusError error;
+ AvahiClient *client;
+ int32_t i_interface, i_protocol;
+ uint32_t u_flags;
+
+ assert(group);
+ assert(name);
+ assert(type);
+ assert(subtype);
+
+ 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 = "";
+
+ dbus_error_init(&error);
+
+ if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddServiceSubtype"))) {
+ r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
+ goto fail;
+ }
+
+ i_interface = (int32_t) interface;
+ i_protocol = (int32_t) protocol;
+ u_flags = (uint32_t) flags;
+
+ if (!dbus_message_append_args(
+ message,
+ DBUS_TYPE_INT32, &i_interface,
+ DBUS_TYPE_INT32, &i_protocol,
+ DBUS_TYPE_UINT32, &u_flags,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_STRING, &type,
+ DBUS_TYPE_STRING, &domain,
+ DBUS_TYPE_STRING, &subtype,
+ DBUS_TYPE_INVALID)) {
+ r = avahi_client_set_errno(group->client, AVAHI_ERR_NO_MEMORY);
+ goto fail;
+ }
+
+ if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
+ dbus_error_is_set (&error)) {
+ r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
+ goto fail;
+ }
+
+ if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID) ||
+ dbus_error_is_set (&error)) {
+ r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
+ goto fail;
+ }
+
+ dbus_message_unref(message);
+ dbus_message_unref(reply);
+
+ return AVAHI_OK;
+
+fail:
+
+ if (dbus_error_is_set(&error)) {
+ r = avahi_client_set_dbus_error(client, &error);
+ dbus_error_free(&error);
+ }
+
+ if (message)
+ dbus_message_unref(message);
+
+ if (reply)
+ dbus_message_unref(reply);
+
+ return r;
+
+}