return AVAHI_SERVICE_COOKIE_INVALID;
}
+
+int avahi_client_is_service_local(AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain) {
+ DBusMessage *message = NULL, *reply = NULL;
+ DBusError error;
+ int32_t i_interface, i_protocol;
+ int b;
+
+ assert(client);
+ assert(name);
+ assert(type);
+ assert(domain);
+
+ if (client->state == AVAHI_CLIENT_DISCONNECTED) {
+ avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
+ return AVAHI_SERVICE_COOKIE_INVALID;
+ }
+
+ dbus_error_init (&error);
+
+ if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "IsServiceLocal"))) {
+ avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
+ goto fail;
+ }
+
+ i_interface = (int32_t) interface;
+ i_protocol = (int32_t) protocol;
+
+ if (!dbus_message_append_args(
+ message,
+ DBUS_TYPE_INT32, &i_interface,
+ DBUS_TYPE_INT32, &i_protocol,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_STRING, &type,
+ DBUS_TYPE_STRING, &domain,
+ DBUS_TYPE_INVALID)) {
+ avahi_client_set_errno (client, AVAHI_ERR_NO_MEMORY);
+ goto fail;
+ }
+
+ reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error);
+
+ if (!reply || dbus_error_is_set (&error))
+ goto fail;
+
+ if (!dbus_message_get_args (reply, &error, DBUS_TYPE_BOOLEAN, &b, DBUS_TYPE_INVALID) ||
+ dbus_error_is_set (&error))
+ goto fail;
+
+ dbus_message_unref(message);
+ dbus_message_unref(reply);
+
+ return b;
+
+fail:
+
+ if (message)
+ dbus_message_unref(message);
+ if (reply)
+ dbus_message_unref(reply);
+
+ if (dbus_error_is_set(&error)) {
+ avahi_client_set_dbus_error(client, &error);
+ dbus_error_free(&error);
+ }
+
+ return AVAHI_SERVICE_COOKIE_INVALID;
+}
/** Return the local service cookie. returns AVAHI_SERVICE_COOKIE_INVALID on failure. */
uint32_t avahi_client_get_local_service_cookie(AvahiClient *client);
+/** Return 1 if the specified service is a registered locally, negative on failure, 0 otherwise. */
+int avahi_client_is_service_local(AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain);
+
#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
#endif