X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;ds=sidebyside;f=avahi-daemon%2Fsimple-protocol.c;h=f7c3f1eb2cff56e0f9050499421bc0632a89a4ef;hb=f43187377e0c89ba02ca23e88efa01bbb255e037;hp=274568c7e5d60d08e08c37136c616a72bebe25ab;hpb=14f8d9beb7ef14b0aab5512345e09109bdd8cb0c;p=catta diff --git a/avahi-daemon/simple-protocol.c b/avahi-daemon/simple-protocol.c index 274568c..f7c3f1e 100644 --- a/avahi-daemon/simple-protocol.c +++ b/avahi-daemon/simple-protocol.c @@ -41,8 +41,6 @@ #define BUFFER_SIZE (20*1024) -#define UNIX_SOCKET AVAHI_RUNTIME_DIR "/socket" - #define CLIENTS_MAX 50 typedef struct Client Client; @@ -153,7 +151,7 @@ static void client_output(Client *c, const guint8*data, guint size) { c->poll_fd.events |= G_IO_OUT; } -static void client_output_printf(Client *c, gchar *format, ...) { +static void client_output_printf(Client *c, const gchar *format, ...) { gchar *t; va_list ap; @@ -166,7 +164,7 @@ static void client_output_printf(Client *c, gchar *format, ...) { } -static void host_name_resolver_callback(AvahiHostNameResolver *r, gint iface, guchar protocol, AvahiBrowserEvent event, const gchar *hostname, const AvahiAddress *a, gpointer userdata) { +static void host_name_resolver_callback(AvahiHostNameResolver *r, AvahiIfIndex iface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar *hostname, const AvahiAddress *a, gpointer userdata) { Client *c = userdata; g_assert(c); @@ -183,7 +181,7 @@ static void host_name_resolver_callback(AvahiHostNameResolver *r, gint iface, gu c->state = CLIENT_DEAD; } -static void address_resolver_callback(AvahiAddressResolver *r, gint iface, guchar protocol, AvahiBrowserEvent event, const AvahiAddress *a, const gchar *hostname, gpointer userdata) { +static void address_resolver_callback(AvahiAddressResolver *r, AvahiIfIndex iface, AvahiProtocol protocol, AvahiBrowserEvent event, const AvahiAddress *a, const gchar *hostname, gpointer userdata) { Client *c = userdata; @@ -197,7 +195,7 @@ static void address_resolver_callback(AvahiAddressResolver *r, gint iface, gucha c->state = CLIENT_DEAD; } -static void dns_server_browser_callback(AvahiDNSServerBrowser *b, gint interface, guchar protocol, AvahiBrowserEvent event, const gchar *host_name, const AvahiAddress *a, guint16 port, gpointer userdata) { +static void dns_server_browser_callback(AvahiDNSServerBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar *host_name, const AvahiAddress *a, guint16 port, gpointer userdata) { Client *c = userdata; gchar t[64]; @@ -423,14 +421,14 @@ int simple_protocol_setup(GMainContext *c) { memset(&sa, 0, sizeof(sa)); sa.sun_family = AF_LOCAL; - strncpy(sa.sun_path, UNIX_SOCKET, sizeof(sa.sun_path)-1); + strncpy(sa.sun_path, AVAHI_SOCKET, sizeof(sa.sun_path)-1); /* We simply remove existing UNIX sockets under this name. The Avahi daemons makes sure that it runs only once on a host, therefore sockets that already exist are stale and may be removed without any ill effects */ - unlink(UNIX_SOCKET); + unlink(AVAHI_SOCKET); if (bind(server->fd, &sa, sizeof(sa)) < 0) { avahi_log_warn("bind(): %s", strerror(errno)); @@ -471,7 +469,7 @@ void simple_protocol_shutdown(void) { client_free(server->clients); if (server->bind_successful) - unlink(UNIX_SOCKET); + unlink(AVAHI_SOCKET); if (server->fd >= 0) close(server->fd);