+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;
+
+}
+