+
+ i->path = avahi_strdup_printf("/Client%u/AddressResolver%u", client->id, i->id);
+ dbus_connection_register_object_path(c, i->path, &vtable, i);
+ return avahi_dbus_respond_path(c, m, i->path);
+
+ } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "RecordBrowserNew")) {
+ Client *client;
+ RecordBrowserInfo *i;
+ static const DBusObjectPathVTable vtable = {
+ NULL,
+ avahi_dbus_msg_record_browser_impl,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ };
+ int32_t interface, protocol;
+ uint32_t flags;
+ char *name;
+ uint16_t type, clazz;
+ AvahiKey *key;
+
+ if (!dbus_message_get_args(
+ m, &error,
+ DBUS_TYPE_INT32, &interface,
+ DBUS_TYPE_INT32, &protocol,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_UINT16, &clazz,
+ DBUS_TYPE_UINT16, &type,
+ DBUS_TYPE_UINT32, &flags,
+ DBUS_TYPE_INVALID) || !name) {
+ avahi_log_warn("Error parsing Server::RecordBrowserNew message");
+ goto fail;
+ }
+
+ if (!avahi_is_valid_domain_name(name))
+ return avahi_dbus_respond_error(c, m, AVAHI_ERR_INVALID_DOMAIN_NAME, NULL);
+
+ if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
+ avahi_log_warn("Too many clients, client request failed.");
+ return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
+ }
+
+ if (client->n_objects >= server->n_objects_per_client_max) {
+ avahi_log_warn("Too many objects for client '%s', client request failed.", client->name);
+ return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
+ }
+
+ i = avahi_new(RecordBrowserInfo, 1);
+ i->id = ++client->current_id;
+ i->client = client;
+ i->path = NULL;
+ AVAHI_LLIST_PREPEND(RecordBrowserInfo, record_browsers, client->record_browsers, i);
+ client->n_objects++;
+
+ key = avahi_key_new(name, clazz, type);
+ assert(key);
+
+ if (!(i->record_browser = avahi_s_record_browser_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, key, (AvahiLookupFlags) flags, avahi_dbus_record_browser_callback, i))) {
+ avahi_key_unref(key);
+ avahi_dbus_record_browser_free(i);
+ return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
+ }
+
+ avahi_key_unref(key);
+
+ i->path = avahi_strdup_printf("/Client%u/RecordBrowser%u", client->id, i->id);