summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-09-10 02:21:50 +0000
committerLennart Poettering <lennart@poettering.net>2005-09-10 02:21:50 +0000
commitcc02fb84d6b727b075a48afed4899706658e0731 (patch)
treed2967bc55a577be58dc5ff643f55d15717017b75
parent30f94fc47685900079f23c936668bf904beae05f (diff)
add new DBUS function IsServiceLocal()
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@562 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
-rw-r--r--avahi-daemon/Server.introspect10
-rw-r--r--avahi-daemon/dbus-protocol.c33
2 files changed, 43 insertions, 0 deletions
diff --git a/avahi-daemon/Server.introspect b/avahi-daemon/Server.introspect
index 3cd85f8..bf68bcb 100644
--- a/avahi-daemon/Server.introspect
+++ b/avahi-daemon/Server.introspect
@@ -101,6 +101,16 @@
<arg name="txt" type="aay" direction="out"/>
</method>
+ <method name="IsServiceLocal">
+ <arg name="interface" type="i" direction="in"/>
+ <arg name="protocol" type="i" direction="in"/>
+ <arg name="name" type="s" direction="in"/>
+ <arg name="type" type="s" direction="in"/>
+ <arg name="domain" type="s" direction="in"/>
+
+ <arg name="is_local" type="b" direction="out"/>
+ </method>
+
<method name="EntryGroupNew">
<arg name="path" type="o" direction="out"/>
</method>
diff --git a/avahi-daemon/dbus-protocol.c b/avahi-daemon/dbus-protocol.c
index 61d26d0..1e69916 100644
--- a/avahi-daemon/dbus-protocol.c
+++ b/avahi-daemon/dbus-protocol.c
@@ -463,6 +463,17 @@ static DBusHandlerResult respond_uint32(DBusConnection *c, DBusMessage *m, uint3
return DBUS_HANDLER_RESULT_HANDLED;
}
+static DBusHandlerResult respond_boolean(DBusConnection *c, DBusMessage *m, int b) {
+ DBusMessage *reply;
+
+ reply = dbus_message_new_method_return(m);
+ dbus_message_append_args(reply, DBUS_TYPE_BOOLEAN, &b, DBUS_TYPE_INVALID);
+ dbus_connection_send(c, reply, NULL);
+ dbus_message_unref(reply);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
static DBusHandlerResult respond_ok(DBusConnection *c, DBusMessage *m) {
DBusMessage *reply;
@@ -1561,6 +1572,28 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, void
return respond_uint32(c, m, avahi_server_get_local_service_cookie(avahi_server));
+ } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "IsServiceLocal")) {
+ int32_t interface, protocol;
+ char *name, *type, *domain;
+ int b;
+
+ if (!dbus_message_get_args(
+ m, &error,
+ DBUS_TYPE_INT32, &interface,
+ DBUS_TYPE_INT32, &protocol,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_STRING, &type,
+ DBUS_TYPE_STRING, &domain,
+ DBUS_TYPE_INVALID) || !name || !type || !domain) {
+ avahi_log_warn("Error parsing Server::IsServiceLocal message");
+ goto fail;
+ }
+
+ if ((b = avahi_server_is_service_local(avahi_server, interface, protocol, name, type, domain)) < 0)
+ return respond_error(c, m, avahi_server_errno(avahi_server), NULL);
+
+ return respond_boolean(c, m, b);
+
} else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetNetworkInterfaceNameByIndex")) {
int32_t idx;
int fd;