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 | |
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')
-rw-r--r-- | avahi-daemon/Server.introspect | 4 | ||||
-rw-r--r-- | avahi-daemon/dbus-protocol.c | 20 | ||||
-rw-r--r-- | avahi-daemon/main.c | 2 |
3 files changed, 25 insertions, 1 deletions
diff --git a/avahi-daemon/Server.introspect b/avahi-daemon/Server.introspect index 1229733..3cd85f8 100644 --- a/avahi-daemon/Server.introspect +++ b/avahi-daemon/Server.introspect @@ -33,6 +33,10 @@ <arg name="state" type="i"/> </signal> + <method name="GetLocalServiceCookie"> + <arg name="cookie" type="u" direction="out"/> + </method> + <method name="GetAlternativeHostName"> <arg name="name" type="s" direction="in"/> <arg name="name" type="s" direction="out"/> 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; diff --git a/avahi-daemon/main.c b/avahi-daemon/main.c index 566a276..dab65f7 100644 --- a/avahi-daemon/main.c +++ b/avahi-daemon/main.c @@ -220,7 +220,7 @@ static void server_callback(AvahiServer *s, AvahiServerState state, void *userda #endif if (state == AVAHI_SERVER_RUNNING) { - avahi_log_info("Server startup complete. Host name is %s.", avahi_server_get_host_name_fqdn(s)); + avahi_log_info("Server startup complete. Host name is %s. Local service cookie is %u.", avahi_server_get_host_name_fqdn(s), avahi_server_get_local_service_cookie(s)); static_service_add_to_server(); remove_dns_server_entry_groups(); |