return DBUS_HANDLER_RESULT_HANDLED;
}
+static DBusHandlerResult handle_introspect(DBusConnection *c, DBusMessage *m, const gchar *fname) {
+ gchar *path = NULL;
+ gchar *contents;
+ GError *gerror = NULL;
+ DBusError error;
+
+ g_assert(c);
+ g_assert(m);
+ g_assert(fname);
+
+ dbus_error_init(&error);
+
+ if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
+ avahi_log_warn("Error parsing Introspect message: %s", error.message);
+ goto fail;
+ }
+
+ path = g_strdup_printf("%s/%s", AVAHI_DBUS_INTROSPECTION_DIR, fname);
+
+ if (!(g_file_get_contents(path, &contents, NULL, &gerror))) {
+ avahi_log_warn("Failed to load introspection data: %s", gerror->message);
+ g_error_free(gerror);
+ g_free(path);
+ goto fail;
+ }
+
+ g_free(path);
+
+ respond_string(c, m, contents);
+ g_free(contents);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+
+fail:
+ if (dbus_error_is_set(&error))
+ dbus_error_free(&error);
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+}
+
static DBusHandlerResult msg_signal_filter_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
GMainLoop *loop = userdata;
DBusError error;
dbus_message_get_path(m),
dbus_message_get_member(m));
+ /* Introspection */
+ if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
+ return handle_introspect(c, m, "EntryGroup.introspect");
+
/* Access control */
if (strcmp(dbus_message_get_sender(m), i->client->name))
return respond_error(c, m, DBUS_ERROR_ACCESS_DENIED, NULL);
dbus_message_get_path(m),
dbus_message_get_member(m));
+ /* Introspection */
+ if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
+ return handle_introspect(c, m, "DomainBrowser.introspect");
+
/* Access control */
if (strcmp(dbus_message_get_sender(m), i->client->name))
return respond_error(c, m, DBUS_ERROR_ACCESS_DENIED, NULL);
dbus_message_get_path(m),
dbus_message_get_member(m));
+ /* Introspection */
+ if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
+ return handle_introspect(c, m, "ServiceTypeBrowser.introspect");
+
/* Access control */
if (strcmp(dbus_message_get_sender(m), i->client->name))
return respond_error(c, m, DBUS_ERROR_ACCESS_DENIED, NULL);
dbus_message_get_path(m),
dbus_message_get_member(m));
+ /* Introspection */
+ if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
+ return handle_introspect(c, m, "ServiceBrowser.introspect");
+
/* Access control */
if (strcmp(dbus_message_get_sender(m), i->client->name))
return respond_error(c, m, DBUS_ERROR_ACCESS_DENIED, NULL);
DBusMessage *reply;
g_assert(r);
- g_assert(host_name);
g_assert(i);
if (event == AVAHI_RESOLVER_FOUND) {
guint n, j;
AvahiStringList *p;
+ g_assert(host_name);
+
g_assert(a);
avahi_address_snprint(t, sizeof(t), a);
service_resolver_free(i);
}
+
static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
DBusError error;
dbus_message_get_path(m),
dbus_message_get_member(m));
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetHostName")) {
+ if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
+ return handle_introspect(c, m, "Server.introspect");
+
+ else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetHostName")) {
if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
avahi_log_warn("Error parsing Server::GetHostName message");
i = g_new(EntryGroupInfo, 1);
i->id = ++client->current_id;
i->client = client;
- i->path = g_strdup_printf("/org/freedesktop/Avahi/Client%u/EntryGroup%u", client->id, i->id);
+ i->path = g_strdup_printf("/Client%u/EntryGroup%u", client->id, i->id);
AVAHI_LLIST_PREPEND(EntryGroupInfo, entry_groups, client->entry_groups, i);
if (!(i->entry_group = avahi_entry_group_new(avahi_server, entry_group_callback, i))) {
i = g_new(DomainBrowserInfo, 1);
i->id = ++client->current_id;
i->client = client;
- i->path = g_strdup_printf("/org/freedesktop/Avahi/Client%u/DomainBrowser%u", client->id, i->id);
+ i->path = g_strdup_printf("/Client%u/DomainBrowser%u", client->id, i->id);
AVAHI_LLIST_PREPEND(DomainBrowserInfo, domain_browsers, client->domain_browsers, i);
i = g_new(ServiceTypeBrowserInfo, 1);
i->id = ++client->current_id;
i->client = client;
- i->path = g_strdup_printf("/org/freedesktop/Avahi/Client%u/ServiceTypeBrowser%u", client->id, i->id);
+ i->path = g_strdup_printf("/Client%u/ServiceTypeBrowser%u", client->id, i->id);
AVAHI_LLIST_PREPEND(ServiceTypeBrowserInfo, service_type_browsers, client->service_type_browsers, i);
i = g_new(ServiceBrowserInfo, 1);
i->id = ++client->current_id;
i->client = client;
- i->path = g_strdup_printf("/org/freedesktop/Avahi/Client%u/ServiceBrowser%u", client->id, i->id);
+ i->path = g_strdup_printf("/Client%u/ServiceBrowser%u", client->id, i->id);
AVAHI_LLIST_PREPEND(ServiceBrowserInfo, service_browsers, client->service_browsers, i);
avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
fail:
if (dbus_error_is_set(&error))
dbus_error_free(&error);