diff options
author | Lennart Poettering <lennart@poettering.net> | 2005-09-10 00:22:30 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2005-09-10 00:22:30 +0000 |
commit | e8edcf439d2ce1593af11c357893681b6b3c0bb4 (patch) | |
tree | d630ac06209abd27e352cef664394bc0cb9b904e /avahi-daemon/dbus-protocol.c | |
parent | a9566d5dcac080d7fa91546823277c57a5d09a5f (diff) |
* add magic identification cookies to service TXT records automatically
* add an API to query the local service cookie
* add a DBUS interface to query the local service cookie
* wrap that in avahi-client
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@555 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-daemon/dbus-protocol.c')
-rw-r--r-- | avahi-daemon/dbus-protocol.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/avahi-daemon/dbus-protocol.c b/avahi-daemon/dbus-protocol.c index 9cc4434..61d26d0 100644 --- a/avahi-daemon/dbus-protocol.c +++ b/avahi-daemon/dbus-protocol.c @@ -452,6 +452,17 @@ static DBusHandlerResult respond_int32(DBusConnection *c, DBusMessage *m, int32_ return DBUS_HANDLER_RESULT_HANDLED; } +static DBusHandlerResult respond_uint32(DBusConnection *c, DBusMessage *m, uint32_t u) { + DBusMessage *reply; + + reply = dbus_message_new_method_return(m); + dbus_message_append_args(reply, DBUS_TYPE_UINT32, &u, 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; @@ -1541,6 +1552,15 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, void state = avahi_server_get_state(avahi_server); return respond_int32(c, m, (int32_t) state); + } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetLocalServiceCookie")) { + + if (!(dbus_message_get_args(m, &error, DBUS_TYPE_INVALID))) { + avahi_log_warn("Error parsing Server::GetLocalServiceCookie message"); + goto fail; + } + + 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, "GetNetworkInterfaceNameByIndex")) { int32_t idx; int fd; |