From 8b5cd6ffd9137b14b7ed678f10a551e3911e4a40 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 13 Aug 2005 22:04:21 +0000 Subject: [PATCH] Rename some server side objects/symbols so that they do not conflict with the same things on the client side. i.e. AvahiEntryGroup -> AvahiSEntryGroup git-svn-id: file:///home/lennart/svn/public/avahi/trunk@310 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-core/announce.c | 8 +- avahi-core/announce.h | 4 +- avahi-core/avahi-test.c | 78 ++++++------ avahi-core/browse-dns-server.c | 46 +++---- avahi-core/browse-domain.c | 30 ++--- avahi-core/browse-service-type.c | 28 ++--- avahi-core/browse-service.c | 30 ++--- avahi-core/browse.c | 48 ++++---- avahi-core/browse.h | 2 +- avahi-core/conformance-test.c | 14 +-- avahi-core/core.h | 203 +++++++++++++++---------------- avahi-core/iface.c | 32 ++--- avahi-core/iface.h | 4 +- avahi-core/resolve-address.c | 38 +++--- avahi-core/resolve-host-name.c | 44 +++---- avahi-core/resolve-service.c | 62 +++++----- avahi-core/server.c | 122 +++++++++---------- avahi-core/server.h | 37 +++--- avahi-daemon/dbus-protocol.c | 64 +++++----- avahi-daemon/main.c | 20 +-- avahi-daemon/simple-protocol.c | 45 ++++--- avahi-daemon/static-services.c | 14 +-- avahi-discover-standalone/main.c | 24 ++-- examples/browse-services.c | 14 +-- examples/publish-service.c | 12 +- 25 files changed, 516 insertions(+), 507 deletions(-) diff --git a/avahi-core/announce.c b/avahi-core/announce.c index b6ded71..c6edd83 100644 --- a/avahi-core/announce.c +++ b/avahi-core/announce.c @@ -67,7 +67,7 @@ static void set_timeout(AvahiAnnouncement *a, const struct timeval *tv) { static void next_state(AvahiAnnouncement *a); -void avahi_entry_group_check_probed(AvahiEntryGroup *g, int immediately) { +void avahi_s_entry_group_check_probed(AvahiSEntryGroup *g, int immediately) { AvahiEntry *e; assert(g); assert(!g->dead); @@ -77,7 +77,7 @@ void avahi_entry_group_check_probed(AvahiEntryGroup *g, int immediately) { if (g->state != AVAHI_ENTRY_GROUP_REGISTERING || g->n_probing > 0) return; - avahi_entry_group_change_state(g, AVAHI_ENTRY_GROUP_ESTABLISHED); + avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_ESTABLISHED); if (g->dead) return; @@ -116,7 +116,7 @@ static void next_state(AvahiAnnouncement *a) { assert(a->entry->group); - avahi_entry_group_check_probed(a->entry->group, 1); + avahi_s_entry_group_check_probed(a->entry->group, 1); } else if (a->state == AVAHI_PROBING) { @@ -311,7 +311,7 @@ void avahi_announce_entry(AvahiServer *s, AvahiEntry *e) { avahi_interface_monitor_walk(s->monitor, e->interface, e->protocol, announce_walk_callback, e); } -void avahi_announce_group(AvahiServer *s, AvahiEntryGroup *g) { +void avahi_announce_group(AvahiServer *s, AvahiSEntryGroup *g) { AvahiEntry *e; assert(s); diff --git a/avahi-core/announce.h b/avahi-core/announce.h index d5928be..9c01d26 100644 --- a/avahi-core/announce.h +++ b/avahi-core/announce.h @@ -53,11 +53,11 @@ struct AvahiAnnouncement { void avahi_announce_interface(AvahiServer *s, AvahiInterface *i); void avahi_announce_entry(AvahiServer *s, AvahiEntry *e); -void avahi_announce_group(AvahiServer *s, AvahiEntryGroup *g); +void avahi_announce_group(AvahiServer *s, AvahiSEntryGroup *g); void avahi_entry_return_to_initial_state(AvahiServer *s, AvahiEntry *e, AvahiInterface *i); -void avahi_entry_group_check_probed(AvahiEntryGroup *g, int immediately); +void avahi_s_entry_group_check_probed(AvahiSEntryGroup *g, int immediately); int avahi_entry_is_registered(AvahiServer *s, AvahiEntry *e, AvahiInterface *i); int avahi_entry_is_probing(AvahiServer *s, AvahiEntry *e, AvahiInterface *i); diff --git a/avahi-core/avahi-test.c b/avahi-core/avahi-test.c index cecd5bf..2713185 100644 --- a/avahi-core/avahi-test.c +++ b/avahi-core/avahi-test.c @@ -37,7 +37,7 @@ #include -static AvahiEntryGroup *group = NULL; +static AvahiSEntryGroup *group = NULL; static AvahiServer *server = NULL; static char *service_name = NULL; @@ -56,7 +56,7 @@ static int dump_timeout(void* data) { return 1; } -static void record_browser_callback(AvahiRecordBrowser *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, void* userdata) { +static void record_browser_callback(AvahiSRecordBrowser *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, void* userdata) { char *t; assert(r); @@ -73,7 +73,7 @@ static void record_browser_callback(AvahiRecordBrowser *r, AvahiIfIndex interfac static void remove_entries(void); static void create_entries(int new_name); -static void entry_group_callback(AvahiServer *s, AvahiEntryGroup *g, AvahiEntryGroupState state, void* userdata) { +static void entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void* userdata) { avahi_log_debug("entry group state: %i", state); if (state == AVAHI_ENTRY_GROUP_COLLISION) { @@ -106,7 +106,7 @@ static void server_callback(AvahiServer *s, AvahiServerState state, void* userda static void remove_entries(void) { if (group) - avahi_entry_group_reset(group); + avahi_s_entry_group_reset(group); } static void create_entries(int new_name) { @@ -115,9 +115,9 @@ static void create_entries(int new_name) { remove_entries(); if (!group) - group = avahi_entry_group_new(server, entry_group_callback, NULL); + group = avahi_s_entry_group_new(server, entry_group_callback, NULL); - assert(avahi_entry_group_is_empty(group)); + assert(avahi_s_entry_group_is_empty(group)); if (!service_name) service_name = g_strdup("Test Service"); @@ -147,17 +147,17 @@ static void create_entries(int new_name) { goto fail; } - avahi_entry_group_commit(group); + avahi_s_entry_group_commit(group); return; fail: if (group) - avahi_entry_group_free(group); + avahi_s_entry_group_free(group); group = NULL; } -static void hnr_callback(AvahiHostNameResolver *r, AvahiIfIndex iface, AvahiProtocol protocol, AvahiResolverEvent event, const char *hostname, const AvahiAddress *a, void* userdata) { +static void hnr_callback(AvahiSHostNameResolver *r, AvahiIfIndex iface, AvahiProtocol protocol, AvahiResolverEvent event, const char *hostname, const AvahiAddress *a, void* userdata) { char t[64]; if (a) @@ -166,7 +166,7 @@ static void hnr_callback(AvahiHostNameResolver *r, AvahiIfIndex iface, AvahiProt avahi_log_debug("HNR: (%i.%i) <%s> -> %s [%s]", iface, protocol, hostname, a ? t : "n/a", event == AVAHI_RESOLVER_FOUND ? "found" : "timeout"); } -static void ar_callback(AvahiAddressResolver *r, AvahiIfIndex iface, AvahiProtocol protocol, AvahiResolverEvent event, const AvahiAddress *a, const char *hostname, void* userdata) { +static void ar_callback(AvahiSAddressResolver *r, AvahiIfIndex iface, AvahiProtocol protocol, AvahiResolverEvent event, const AvahiAddress *a, const char *hostname, void* userdata) { char t[64]; avahi_address_snprint(t, sizeof(t), a); @@ -174,21 +174,21 @@ static void ar_callback(AvahiAddressResolver *r, AvahiIfIndex iface, AvahiProtoc avahi_log_debug("AR: (%i.%i) %s -> <%s> [%s]", iface, protocol, t, hostname ? hostname : "n/a", event == AVAHI_RESOLVER_FOUND ? "found" : "timeout"); } -static void db_callback(AvahiDomainBrowser *b, AvahiIfIndex iface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *domain, void* userdata) { +static void db_callback(AvahiSDomainBrowser *b, AvahiIfIndex iface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *domain, void* userdata) { avahi_log_debug("DB: (%i.%i) <%s> [%s]", iface, protocol, domain, event == AVAHI_BROWSER_NEW ? "new" : "remove"); } -static void stb_callback(AvahiServiceTypeBrowser *b, AvahiIfIndex iface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *service_type, const char *domain, void* userdata) { +static void stb_callback(AvahiSServiceTypeBrowser *b, AvahiIfIndex iface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *service_type, const char *domain, void* userdata) { avahi_log_debug("STB: (%i.%i) %s in <%s> [%s]", iface, protocol, service_type, domain, event == AVAHI_BROWSER_NEW ? "new" : "remove"); } -static void sb_callback(AvahiServiceBrowser *b, AvahiIfIndex iface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, const char *service_type, const char *domain, void* userdata) { +static void sb_callback(AvahiSServiceBrowser *b, AvahiIfIndex iface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, const char *service_type, const char *domain, void* userdata) { avahi_log_debug("SB: (%i.%i) <%s> as %s in <%s> [%s]", iface, protocol, name, service_type, domain, event == AVAHI_BROWSER_NEW ? "new" : "remove"); } -static void sr_callback(AvahiServiceResolver *r, AvahiIfIndex iface, AvahiProtocol protocol, AvahiResolverEvent event, const char *name, const char*service_type, const char*domain_name, const char*hostname, const AvahiAddress *a, uint16_t port, AvahiStringList *txt, void* userdata) { +static void sr_callback(AvahiSServiceResolver *r, AvahiIfIndex iface, AvahiProtocol protocol, AvahiResolverEvent event, const char *name, const char*service_type, const char*domain_name, const char*hostname, const AvahiAddress *a, uint16_t port, AvahiStringList *txt, void* userdata) { if (event == AVAHI_RESOLVER_TIMEOUT) avahi_log_debug("SR: (%i.%i) <%s> as %s in <%s> [timeout]", iface, protocol, name, service_type, domain_name); @@ -203,7 +203,7 @@ static void sr_callback(AvahiServiceResolver *r, AvahiIfIndex iface, AvahiProtoc } } -static void dsb_callback(AvahiDNSServerBrowser *b, AvahiIfIndex iface, AvahiProtocol protocol, AvahiBrowserEvent event, const char*hostname, const AvahiAddress *a, uint16_t port, void* userdata) { +static void dsb_callback(AvahiSDNSServerBrowser *b, AvahiIfIndex iface, AvahiProtocol protocol, AvahiBrowserEvent event, const char*hostname, const AvahiAddress *a, uint16_t port, void* userdata) { char t[64]; avahi_address_snprint(t, sizeof(t), a); avahi_log_debug("DSB: (%i.%i): %s/%s:%i [%s]", iface, protocol, hostname, t, port, event == AVAHI_BROWSER_NEW ? "new" : "remove"); @@ -211,17 +211,17 @@ static void dsb_callback(AvahiDNSServerBrowser *b, AvahiIfIndex iface, AvahiProt int main(int argc, char *argv[]) { GMainLoop *loop = NULL; - AvahiRecordBrowser *r; - AvahiHostNameResolver *hnr; - AvahiAddressResolver *ar; + AvahiSRecordBrowser *r; + AvahiSHostNameResolver *hnr; + AvahiSAddressResolver *ar; AvahiKey *k; AvahiServerConfig config; AvahiAddress a; - AvahiDomainBrowser *db; - AvahiServiceTypeBrowser *stb; - AvahiServiceBrowser *sb; - AvahiServiceResolver *sr; - AvahiDNSServerBrowser *dsb; + AvahiSDomainBrowser *db; + AvahiSServiceTypeBrowser *stb; + AvahiSServiceBrowser *sb; + AvahiSServiceResolver *sr; + AvahiSDNSServerBrowser *dsb; AvahiGLibPoll *glib_poll; int error; @@ -234,22 +234,22 @@ int main(int argc, char *argv[]) { avahi_server_config_free(&config); k = avahi_key_new("_http._tcp.local", AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR); - r = avahi_record_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, k, record_browser_callback, NULL); + r = avahi_s_record_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, k, record_browser_callback, NULL); avahi_key_unref(k); - hnr = avahi_host_name_resolver_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "codes-CompUTER.local", AVAHI_PROTO_UNSPEC, hnr_callback, NULL); + hnr = avahi_s_host_name_resolver_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "codes-CompUTER.local", AVAHI_PROTO_UNSPEC, hnr_callback, NULL); - ar = avahi_address_resolver_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, avahi_address_parse("192.168.50.15", AVAHI_PROTO_INET, &a), ar_callback, NULL); + ar = avahi_s_address_resolver_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, avahi_address_parse("192.168.50.15", AVAHI_PROTO_INET, &a), ar_callback, NULL); - db = avahi_domain_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, db_callback, NULL); + db = avahi_s_domain_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, db_callback, NULL); - stb = avahi_service_type_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, stb_callback, NULL); + stb = avahi_s_service_type_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, stb_callback, NULL); - sb = avahi_service_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_http._tcp", NULL, sb_callback, NULL); + sb = avahi_s_service_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_http._tcp", NULL, sb_callback, NULL); - sr = avahi_service_resolver_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "Ecstasy HTTP", "_http._tcp", "local", AVAHI_PROTO_UNSPEC, sr_callback, NULL); + sr = avahi_s_service_resolver_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "Ecstasy HTTP", "_http._tcp", "local", AVAHI_PROTO_UNSPEC, sr_callback, NULL); - dsb = avahi_dns_server_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "local", AVAHI_DNS_SERVER_RESOLVE, AVAHI_PROTO_UNSPEC, dsb_callback, NULL); + dsb = avahi_s_dns_server_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "local", AVAHI_DNS_SERVER_RESOLVE, AVAHI_PROTO_UNSPEC, dsb_callback, NULL); g_timeout_add(1000*5, dump_timeout, server); @@ -259,16 +259,16 @@ int main(int argc, char *argv[]) { g_main_loop_run(loop); g_main_loop_unref(loop); - avahi_record_browser_free(r); - avahi_host_name_resolver_free(hnr); - avahi_address_resolver_free(ar); - avahi_service_type_browser_free(stb); - avahi_service_browser_free(sb); - avahi_service_resolver_free(sr); - avahi_dns_server_browser_free(dsb); + avahi_s_record_browser_free(r); + avahi_s_host_name_resolver_free(hnr); + avahi_s_address_resolver_free(ar); + avahi_s_service_type_browser_free(stb); + avahi_s_service_browser_free(sb); + avahi_s_service_resolver_free(sr); + avahi_s_dns_server_browser_free(dsb); if (group) - avahi_entry_group_free(group); + avahi_s_entry_group_free(group); if (server) avahi_server_free(server); diff --git a/avahi-core/browse-dns-server.c b/avahi-core/browse-dns-server.c index 720b491..dd896de 100644 --- a/avahi-core/browse-dns-server.c +++ b/avahi-core/browse-dns-server.c @@ -35,33 +35,33 @@ typedef struct AvahiDNSServerInfo AvahiDNSServerInfo; struct AvahiDNSServerInfo { - AvahiDNSServerBrowser *browser; + AvahiSDNSServerBrowser *browser; AvahiIfIndex interface; AvahiProtocol protocol; AvahiRecord *srv_record; - AvahiHostNameResolver *host_name_resolver; + AvahiSHostNameResolver *host_name_resolver; AvahiAddress address; AVAHI_LLIST_FIELDS(AvahiDNSServerInfo, info); }; -struct AvahiDNSServerBrowser { +struct AvahiSDNSServerBrowser { AvahiServer *server; char *domain_name; - AvahiRecordBrowser *record_browser; - AvahiDNSServerBrowserCallback callback; + AvahiSRecordBrowser *record_browser; + AvahiSDNSServerBrowserCallback callback; void* userdata; AvahiProtocol aprotocol; unsigned n_info; - AVAHI_LLIST_FIELDS(AvahiDNSServerBrowser, browser); + AVAHI_LLIST_FIELDS(AvahiSDNSServerBrowser, browser); AVAHI_LLIST_HEAD(AvahiDNSServerInfo, info); }; -static AvahiDNSServerInfo* get_server_info(AvahiDNSServerBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiRecord *r) { +static AvahiDNSServerInfo* get_server_info(AvahiSDNSServerBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiRecord *r) { AvahiDNSServerInfo *i; assert(b); @@ -76,13 +76,13 @@ static AvahiDNSServerInfo* get_server_info(AvahiDNSServerBrowser *b, AvahiIfInde return NULL; } -static void server_info_free(AvahiDNSServerBrowser *b, AvahiDNSServerInfo *i) { +static void server_info_free(AvahiSDNSServerBrowser *b, AvahiDNSServerInfo *i) { assert(b); assert(i); avahi_record_unref(i->srv_record); if (i->host_name_resolver) - avahi_host_name_resolver_free(i->host_name_resolver); + avahi_s_host_name_resolver_free(i->host_name_resolver); AVAHI_LLIST_REMOVE(AvahiDNSServerInfo, info, b->info, i); @@ -92,7 +92,7 @@ static void server_info_free(AvahiDNSServerBrowser *b, AvahiDNSServerInfo *i) { avahi_free(i); } -static void host_name_resolver_callback(AvahiHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char *host_name, const AvahiAddress *a, void* userdata) { +static void host_name_resolver_callback(AvahiSHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char *host_name, const AvahiAddress *a, void* userdata) { AvahiDNSServerInfo *i = userdata; assert(r); @@ -105,12 +105,12 @@ static void host_name_resolver_callback(AvahiHostNameResolver *r, AvahiIfIndex i i->browser->callback(i->browser, i->interface, i->protocol, AVAHI_BROWSER_NEW, i->srv_record->data.srv.name, &i->address, i->srv_record->data.srv.port, i->browser->userdata); } - avahi_host_name_resolver_free(i->host_name_resolver); + avahi_s_host_name_resolver_free(i->host_name_resolver); i->host_name_resolver = NULL; } -static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, void* userdata) { - AvahiDNSServerBrowser *b = userdata; +static void record_browser_callback(AvahiSRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, void* userdata) { + AvahiSDNSServerBrowser *b = userdata; assert(rr); assert(record); @@ -134,7 +134,7 @@ static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interfac i->interface = interface; i->protocol = protocol; i->srv_record = avahi_record_ref(record); - i->host_name_resolver = avahi_host_name_resolver_new(b->server, interface, protocol, record->data.srv.name, b->aprotocol, host_name_resolver_callback, i); + i->host_name_resolver = avahi_s_host_name_resolver_new(b->server, interface, protocol, record->data.srv.name, b->aprotocol, host_name_resolver_callback, i); AVAHI_LLIST_PREPEND(AvahiDNSServerInfo, info, b->info, i); @@ -152,8 +152,8 @@ static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interfac } } -AvahiDNSServerBrowser *avahi_dns_server_browser_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const char *domain, AvahiDNSServerType type, AvahiProtocol aprotocol, AvahiDNSServerBrowserCallback callback, void* userdata) { - AvahiDNSServerBrowser *b; +AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const char *domain, AvahiDNSServerType type, AvahiProtocol aprotocol, AvahiSDNSServerBrowserCallback callback, void* userdata) { + AvahiSDNSServerBrowser *b; AvahiKey *k; char *n = NULL; @@ -166,7 +166,7 @@ AvahiDNSServerBrowser *avahi_dns_server_browser_new(AvahiServer *server, AvahiIf return NULL; } - if (!(b = avahi_new(AvahiDNSServerBrowser, 1))) { + if (!(b = avahi_new(AvahiSDNSServerBrowser, 1))) { avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY); return NULL; } @@ -179,33 +179,33 @@ AvahiDNSServerBrowser *avahi_dns_server_browser_new(AvahiServer *server, AvahiIf b->n_info = 0; AVAHI_LLIST_HEAD_INIT(AvahiDNSServerInfo, b->info); - AVAHI_LLIST_PREPEND(AvahiDNSServerBrowser, browser, server->dns_server_browsers, b); + AVAHI_LLIST_PREPEND(AvahiSDNSServerBrowser, browser, server->dns_server_browsers, b); n = avahi_strdup_printf("%s.%s",type == AVAHI_DNS_SERVER_RESOLVE ? "_domain._udp" : "_dns-update._udp", b->domain_name); k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV); avahi_free(n); - b->record_browser = avahi_record_browser_new(server, interface, protocol, k, record_browser_callback, b); + b->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, record_browser_callback, b); avahi_key_unref(k); if (!b->record_browser) { - avahi_dns_server_browser_free(b); + avahi_s_dns_server_browser_free(b); return NULL; } return b; } -void avahi_dns_server_browser_free(AvahiDNSServerBrowser *b) { +void avahi_s_dns_server_browser_free(AvahiSDNSServerBrowser *b) { assert(b); while (b->info) server_info_free(b, b->info); - AVAHI_LLIST_REMOVE(AvahiDNSServerBrowser, browser, b->server->dns_server_browsers, b); + AVAHI_LLIST_REMOVE(AvahiSDNSServerBrowser, browser, b->server->dns_server_browsers, b); if (b->record_browser) - avahi_record_browser_free(b->record_browser); + avahi_s_record_browser_free(b->record_browser); avahi_free(b->domain_name); avahi_free(b); } diff --git a/avahi-core/browse-domain.c b/avahi-core/browse-domain.c index 44ff291..73b260a 100644 --- a/avahi-core/browse-domain.c +++ b/avahi-core/browse-domain.c @@ -28,20 +28,20 @@ #include "browse.h" -struct AvahiDomainBrowser { +struct AvahiSDomainBrowser { AvahiServer *server; char *domain_name; - AvahiRecordBrowser *record_browser; + AvahiSRecordBrowser *record_browser; - AvahiDomainBrowserCallback callback; + AvahiSDomainBrowserCallback callback; void* userdata; - AVAHI_LLIST_FIELDS(AvahiDomainBrowser, browser); + AVAHI_LLIST_FIELDS(AvahiSDomainBrowser, browser); }; -static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, void* userdata) { - AvahiDomainBrowser *b = userdata; +static void record_browser_callback(AvahiSRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, void* userdata) { + AvahiSDomainBrowser *b = userdata; char *n; assert(rr); @@ -55,8 +55,8 @@ static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interfac avahi_free(n); } -AvahiDomainBrowser *avahi_domain_browser_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const char *domain, AvahiDomainBrowserType type, AvahiDomainBrowserCallback callback, void* userdata) { - AvahiDomainBrowser *b; +AvahiSDomainBrowser *avahi_s_domain_browser_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const char *domain, AvahiDomainBrowserType type, AvahiSDomainBrowserCallback callback, void* userdata) { + AvahiSDomainBrowser *b; AvahiKey *k; char *n = NULL; @@ -69,7 +69,7 @@ AvahiDomainBrowser *avahi_domain_browser_new(AvahiServer *server, AvahiIfIndex i return NULL; } - if (!(b = avahi_new(AvahiDomainBrowser, 1))) { + if (!(b = avahi_new(AvahiSDomainBrowser, 1))) { avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY); return NULL; } @@ -79,7 +79,7 @@ AvahiDomainBrowser *avahi_domain_browser_new(AvahiServer *server, AvahiIfIndex i b->callback = callback; b->userdata = userdata; - AVAHI_LLIST_PREPEND(AvahiDomainBrowser, browser, server->domain_browsers, b); + AVAHI_LLIST_PREPEND(AvahiSDomainBrowser, browser, server->domain_browsers, b); switch (type) { case AVAHI_DOMAIN_BROWSER_BROWSE: @@ -108,24 +108,24 @@ AvahiDomainBrowser *avahi_domain_browser_new(AvahiServer *server, AvahiIfIndex i k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR); avahi_free(n); - b->record_browser = avahi_record_browser_new(server, interface, protocol, k, record_browser_callback, b); + b->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, record_browser_callback, b); avahi_key_unref(k); if (!b->record_browser) { - avahi_domain_browser_free(b); + avahi_s_domain_browser_free(b); return NULL; } return b; } -void avahi_domain_browser_free(AvahiDomainBrowser *b) { +void avahi_s_domain_browser_free(AvahiSDomainBrowser *b) { assert(b); - AVAHI_LLIST_REMOVE(AvahiDomainBrowser, browser, b->server->domain_browsers, b); + AVAHI_LLIST_REMOVE(AvahiSDomainBrowser, browser, b->server->domain_browsers, b); if (b->record_browser) - avahi_record_browser_free(b->record_browser); + avahi_s_record_browser_free(b->record_browser); avahi_free(b->domain_name); avahi_free(b); diff --git a/avahi-core/browse-service-type.c b/avahi-core/browse-service-type.c index 303182e..9467028 100644 --- a/avahi-core/browse-service-type.c +++ b/avahi-core/browse-service-type.c @@ -31,20 +31,20 @@ #include "browse.h" #include "log.h" -struct AvahiServiceTypeBrowser { +struct AvahiSServiceTypeBrowser { AvahiServer *server; char *domain_name; - AvahiRecordBrowser *record_browser; + AvahiSRecordBrowser *record_browser; - AvahiServiceTypeBrowserCallback callback; + AvahiSServiceTypeBrowserCallback callback; void* userdata; - AVAHI_LLIST_FIELDS(AvahiServiceTypeBrowser, browser); + AVAHI_LLIST_FIELDS(AvahiSServiceTypeBrowser, browser); }; -static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, void* userdata) { - AvahiServiceTypeBrowser *b = userdata; +static void record_browser_callback(AvahiSRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, void* userdata) { + AvahiSServiceTypeBrowser *b = userdata; char *n, *e, *c; assert(rr); @@ -84,8 +84,8 @@ fail: avahi_free(n); } -AvahiServiceTypeBrowser *avahi_service_type_browser_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const char *domain, AvahiServiceTypeBrowserCallback callback, void* userdata) { - AvahiServiceTypeBrowser *b; +AvahiSServiceTypeBrowser *avahi_s_service_type_browser_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const char *domain, AvahiSServiceTypeBrowserCallback callback, void* userdata) { + AvahiSServiceTypeBrowser *b; AvahiKey *k; char *n = NULL; @@ -97,7 +97,7 @@ AvahiServiceTypeBrowser *avahi_service_type_browser_new(AvahiServer *server, Ava return NULL; } - if (!(b = avahi_new(AvahiServiceTypeBrowser, 1))) { + if (!(b = avahi_new(AvahiSServiceTypeBrowser, 1))) { avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY); return NULL; } @@ -107,13 +107,13 @@ AvahiServiceTypeBrowser *avahi_service_type_browser_new(AvahiServer *server, Ava b->callback = callback; b->userdata = userdata; - AVAHI_LLIST_PREPEND(AvahiServiceTypeBrowser, browser, server->service_type_browsers, b); + AVAHI_LLIST_PREPEND(AvahiSServiceTypeBrowser, browser, server->service_type_browsers, b); n = avahi_strdup_printf("_services._dns-sd._udp.%s", b->domain_name); k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR); avahi_free(n); - b->record_browser = avahi_record_browser_new(server, interface, protocol, k, record_browser_callback, b); + b->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, record_browser_callback, b); avahi_key_unref(k); if (!b->record_browser) @@ -122,13 +122,13 @@ AvahiServiceTypeBrowser *avahi_service_type_browser_new(AvahiServer *server, Ava return b; } -void avahi_service_type_browser_free(AvahiServiceTypeBrowser *b) { +void avahi_s_service_type_browser_free(AvahiSServiceTypeBrowser *b) { assert(b); - AVAHI_LLIST_REMOVE(AvahiServiceTypeBrowser, browser, b->server->service_type_browsers, b); + AVAHI_LLIST_REMOVE(AvahiSServiceTypeBrowser, browser, b->server->service_type_browsers, b); if (b->record_browser) - avahi_record_browser_free(b->record_browser); + avahi_s_record_browser_free(b->record_browser); avahi_free(b->domain_name); avahi_free(b); diff --git a/avahi-core/browse-service.c b/avahi-core/browse-service.c index 7ed6ded..9082f63 100644 --- a/avahi-core/browse-service.c +++ b/avahi-core/browse-service.c @@ -31,21 +31,21 @@ #include "browse.h" #include "log.h" -struct AvahiServiceBrowser { +struct AvahiSServiceBrowser { AvahiServer *server; char *domain_name; char *service_type; - AvahiRecordBrowser *record_browser; + AvahiSRecordBrowser *record_browser; - AvahiServiceBrowserCallback callback; + AvahiSServiceBrowserCallback callback; void* userdata; - AVAHI_LLIST_FIELDS(AvahiServiceBrowser, browser); + AVAHI_LLIST_FIELDS(AvahiSServiceBrowser, browser); }; -static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, void* userdata) { - AvahiServiceBrowser *b = userdata; +static void record_browser_callback(AvahiSRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, void* userdata) { + AvahiSServiceBrowser *b = userdata; char *n, *e, *c, *s; char service[128]; @@ -86,8 +86,8 @@ fail: avahi_free(n); } -AvahiServiceBrowser *avahi_service_browser_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const char *service_type, const char *domain, AvahiServiceBrowserCallback callback, void* userdata) { - AvahiServiceBrowser *b; +AvahiSServiceBrowser *avahi_s_service_browser_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const char *service_type, const char *domain, AvahiSServiceBrowserCallback callback, void* userdata) { + AvahiSServiceBrowser *b; AvahiKey *k; char *n = NULL; @@ -105,7 +105,7 @@ AvahiServiceBrowser *avahi_service_browser_new(AvahiServer *server, AvahiIfIndex return NULL; } - if (!(b = avahi_new(AvahiServiceBrowser, 1))) { + if (!(b = avahi_new(AvahiSServiceBrowser, 1))) { avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY); return NULL; } @@ -115,31 +115,31 @@ AvahiServiceBrowser *avahi_service_browser_new(AvahiServer *server, AvahiIfIndex b->service_type = avahi_normalize_name(service_type); b->callback = callback; b->userdata = userdata; - AVAHI_LLIST_PREPEND(AvahiServiceBrowser, browser, server->service_browsers, b); + AVAHI_LLIST_PREPEND(AvahiSServiceBrowser, browser, server->service_browsers, b); n = avahi_strdup_printf("%s.%s", b->service_type, b->domain_name); k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR); avahi_free(n); - b->record_browser = avahi_record_browser_new(server, interface, protocol, k, record_browser_callback, b); + b->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, record_browser_callback, b); avahi_key_unref(k); if (!b->record_browser) { - avahi_service_browser_free(b); + avahi_s_service_browser_free(b); return NULL; } return b; } -void avahi_service_browser_free(AvahiServiceBrowser *b) { +void avahi_s_service_browser_free(AvahiSServiceBrowser *b) { assert(b); - AVAHI_LLIST_REMOVE(AvahiServiceBrowser, browser, b->server->service_browsers, b); + AVAHI_LLIST_REMOVE(AvahiSServiceBrowser, browser, b->server->service_browsers, b); if (b->record_browser) - avahi_record_browser_free(b->record_browser); + avahi_s_record_browser_free(b->record_browser); avahi_free(b->domain_name); avahi_free(b->service_type); diff --git a/avahi-core/browse.c b/avahi-core/browse.c index d54e4ee..3fb22c8 100644 --- a/avahi-core/browse.c +++ b/avahi-core/browse.c @@ -29,7 +29,7 @@ #include "browse.h" #include "log.h" -struct AvahiRecordBrowser { +struct AvahiSRecordBrowser { int dead; AvahiServer *server; @@ -41,15 +41,15 @@ struct AvahiRecordBrowser { AvahiTimeEvent *query_time_event; AvahiTimeEvent *scan_time_event; - AvahiRecordBrowserCallback callback; + AvahiSRecordBrowserCallback callback; void* userdata; - AVAHI_LLIST_FIELDS(AvahiRecordBrowser, browser); - AVAHI_LLIST_FIELDS(AvahiRecordBrowser, by_key); + AVAHI_LLIST_FIELDS(AvahiSRecordBrowser, browser); + AVAHI_LLIST_FIELDS(AvahiSRecordBrowser, by_key); }; static void elapse_callback(AvahiTimeEvent *e, void *userdata) { - AvahiRecordBrowser *s = userdata; + AvahiSRecordBrowser *s = userdata; struct timeval tv; /* char *t; */ @@ -70,7 +70,7 @@ static void elapse_callback(AvahiTimeEvent *e, void *userdata) { } struct cbdata { - AvahiRecordBrowser *record_browser; + AvahiSRecordBrowser *record_browser; AvahiInterface *interface; }; @@ -97,7 +97,7 @@ static void* scan_cache_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEnt } static void scan_interface_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) { - AvahiRecordBrowser *b = userdata; + AvahiSRecordBrowser *b = userdata; struct cbdata cbdata = { b, i }; assert(m); @@ -109,7 +109,7 @@ static void scan_interface_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, } static void scan_callback(AvahiTimeEvent *e, void *userdata) { - AvahiRecordBrowser *b = userdata; + AvahiSRecordBrowser *b = userdata; assert(b); /* Scan the caches */ @@ -122,8 +122,8 @@ static void scan_callback(AvahiTimeEvent *e, void *userdata) { } } -AvahiRecordBrowser *avahi_record_browser_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, AvahiKey *key, AvahiRecordBrowserCallback callback, void* userdata) { - AvahiRecordBrowser *b, *t; +AvahiSRecordBrowser *avahi_s_record_browser_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, AvahiKey *key, AvahiSRecordBrowserCallback callback, void* userdata) { + AvahiSRecordBrowser *b, *t; struct timeval tv; assert(server); @@ -140,7 +140,7 @@ AvahiRecordBrowser *avahi_record_browser_new(AvahiServer *server, AvahiIfIndex i return NULL; } - if (!(b = avahi_new(AvahiRecordBrowser, 1))) { + if (!(b = avahi_new(AvahiSRecordBrowser, 1))) { avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY); return NULL; } @@ -159,11 +159,11 @@ AvahiRecordBrowser *avahi_record_browser_new(AvahiServer *server, AvahiIfIndex i avahi_elapse_time(&tv, b->sec_delay*1000, 0); b->query_time_event = avahi_time_event_new(server->time_event_queue, &tv, elapse_callback, b); - AVAHI_LLIST_PREPEND(AvahiRecordBrowser, browser, server->record_browsers, b); + AVAHI_LLIST_PREPEND(AvahiSRecordBrowser, browser, server->record_browsers, b); /* Add the new entry to the record_browser hash table */ t = avahi_hashmap_lookup(server->record_browser_hashmap, key); - AVAHI_LLIST_PREPEND(AvahiRecordBrowser, by_key, t, b); + AVAHI_LLIST_PREPEND(AvahiSRecordBrowser, by_key, t, b); avahi_hashmap_replace(server->record_browser_hashmap, key, t); /* The currenlty cached entries are scanned a bit later */ @@ -172,7 +172,7 @@ AvahiRecordBrowser *avahi_record_browser_new(AvahiServer *server, AvahiIfIndex i return b; } -void avahi_record_browser_free(AvahiRecordBrowser *b) { +void avahi_s_record_browser_free(AvahiSRecordBrowser *b) { assert(b); assert(!b->dead); @@ -190,15 +190,15 @@ void avahi_record_browser_free(AvahiRecordBrowser *b) { } } -void avahi_record_browser_destroy(AvahiRecordBrowser *b) { - AvahiRecordBrowser *t; +void avahi_s_record_browser_destroy(AvahiSRecordBrowser *b) { + AvahiSRecordBrowser *t; assert(b); - AVAHI_LLIST_REMOVE(AvahiRecordBrowser, browser, b->server->record_browsers, b); + AVAHI_LLIST_REMOVE(AvahiSRecordBrowser, browser, b->server->record_browsers, b); t = avahi_hashmap_lookup(b->server->record_browser_hashmap, b->key); - AVAHI_LLIST_REMOVE(AvahiRecordBrowser, by_key, t, b); + AVAHI_LLIST_REMOVE(AvahiSRecordBrowser, by_key, t, b); if (t) avahi_hashmap_replace(b->server->record_browser_hashmap, t->key, t); else @@ -215,8 +215,8 @@ void avahi_record_browser_destroy(AvahiRecordBrowser *b) { } void avahi_browser_cleanup(AvahiServer *server) { - AvahiRecordBrowser *b; - AvahiRecordBrowser *n; + AvahiSRecordBrowser *b; + AvahiSRecordBrowser *n; assert(server); @@ -224,14 +224,14 @@ void avahi_browser_cleanup(AvahiServer *server) { n = b->browser_next; if (b->dead) - avahi_record_browser_destroy(b); + avahi_s_record_browser_destroy(b); } server->need_browser_cleanup = 0; } void avahi_browser_notify(AvahiServer *server, AvahiInterface *i, AvahiRecord *record, AvahiBrowserEvent event) { - AvahiRecordBrowser *b; + AvahiSRecordBrowser *b; assert(server); assert(record); @@ -242,7 +242,7 @@ void avahi_browser_notify(AvahiServer *server, AvahiInterface *i, AvahiRecord *r } int avahi_is_subscribed(AvahiServer *server, AvahiInterface *i, AvahiKey *k) { - AvahiRecordBrowser *b; + AvahiSRecordBrowser *b; assert(server); assert(k); @@ -254,7 +254,7 @@ int avahi_is_subscribed(AvahiServer *server, AvahiInterface *i, AvahiKey *k) { } void avahi_browser_new_interface(AvahiServer*s, AvahiInterface *i) { - AvahiRecordBrowser *b; + AvahiSRecordBrowser *b; assert(s); assert(i); diff --git a/avahi-core/browse.h b/avahi-core/browse.h index 21f102a..a38075e 100644 --- a/avahi-core/browse.h +++ b/avahi-core/browse.h @@ -32,7 +32,7 @@ void avahi_browser_notify(AvahiServer *s, AvahiInterface *i, AvahiRecord *record int avahi_is_subscribed(AvahiServer *s, AvahiInterface *i, AvahiKey *k); -void avahi_record_browser_destroy(AvahiRecordBrowser *b); +void avahi_s_record_browser_destroy(AvahiSRecordBrowser *b); void avahi_browser_new_interface(AvahiServer*s, AvahiInterface *i); diff --git a/avahi-core/conformance-test.c b/avahi-core/conformance-test.c index ebf9083..b786e85 100644 --- a/avahi-core/conformance-test.c +++ b/avahi-core/conformance-test.c @@ -39,7 +39,7 @@ #include "log.h" static char *name = NULL; -static AvahiEntryGroup *group = NULL; +static AvahiSEntryGroup *group = NULL; static int try = 0; static AvahiServer *avahi = NULL; @@ -52,7 +52,7 @@ static int dump_timeout(void* data) { return 1; } -static void entry_group_callback(AvahiServer *s, AvahiEntryGroup *g, AvahiEntryGroupState state, void* userdata); +static void entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void* userdata); static void create_service(const char *t) { char *n; @@ -64,12 +64,12 @@ static void create_service(const char *t) { name = n; if (group) - avahi_entry_group_reset(group); + avahi_s_entry_group_reset(group); else - group = avahi_entry_group_new(avahi, entry_group_callback, NULL); + group = avahi_s_entry_group_new(avahi, entry_group_callback, NULL); avahi_server_add_service(avahi, group, 0, AF_UNSPEC, name, "_http._tcp", NULL, NULL, 80, "foo", NULL); - avahi_entry_group_commit(group); + avahi_s_entry_group_commit(group); try++; } @@ -84,7 +84,7 @@ static int rename_timeout(void* data) { return 1; } -static void entry_group_callback(AvahiServer *s, AvahiEntryGroup *g, AvahiEntryGroupState state, void* userdata) { +static void entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void* userdata) { if (state == AVAHI_ENTRY_GROUP_COLLISION) create_service(NULL); else if (state == AVAHI_ENTRY_GROUP_ESTABLISHED) { @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) { g_main_loop_unref(loop); if (group) - avahi_entry_group_free(group); + avahi_s_entry_group_free(group); avahi_server_free(avahi); avahi_glib_poll_free(glib_poll); diff --git a/avahi-core/core.h b/avahi-core/core.h index 4431d80..1f2dda9 100644 --- a/avahi-core/core.h +++ b/avahi-core/core.h @@ -40,11 +40,8 @@ AVAHI_C_DECL_BEGIN /** An mDNS responder object */ typedef struct AvahiServer AvahiServer; -/** A locally registered DNS resource record */ -typedef struct AvahiEntry AvahiEntry; - /** A group of locally registered DNS RRs */ -typedef struct AvahiEntryGroup AvahiEntryGroup; +typedef struct AvahiSEntryGroup AvahiSEntryGroup; #ifndef DOXYGEN_SHOULD_SKIP_THIS AVAHI_C_DECL_END @@ -73,8 +70,8 @@ typedef enum { /** Prototype for callback functions which are called whenever the state of an AvahiServer object changes */ typedef void (*AvahiServerCallback) (AvahiServer *s, AvahiServerState state, void* userdata); -/** Prototype for callback functions which are called whenever the state of an AvahiEntryGroup object changes */ -typedef void (*AvahiEntryGroupCallback) (AvahiServer *s, AvahiEntryGroup *g, AvahiEntryGroupState state, void* userdata); +/** Prototype for callback functions which are called whenever the state of an AvahiSEntryGroup object changes */ +typedef void (*AvahiSEntryGroupCallback) (AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void* userdata); /** Stores configuration options for a server instance */ typedef struct AvahiServerConfig { @@ -166,7 +163,7 @@ AvahiServerState avahi_server_get_state(AvahiServer *s); * the current iteration. It is not safe to call any other * avahi_server_xxx() function during the iteration. If the last entry * has been read, NULL is returned. */ -const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiEntryGroup *g, void **state); +const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiSEntryGroup *g, void **state); /** Callback prototype for avahi_server_dump() */ typedef void (*AvahiDumpCallback)(const char *text, void* userdata); @@ -177,35 +174,35 @@ int avahi_server_dump(AvahiServer *s, AvahiDumpCallback callback, void* userdata /** Create a new entry group. The specified callback function is * called whenever the state of the group changes. Use entry group * objects to keep track of you RRs. Add new RRs to a group using - * avahi_server_add_xxx(). Make sure to call avahi_entry_group_commit() + * avahi_server_add_xxx(). Make sure to call avahi_s_entry_group_commit() * to start the registration process for your RRs */ -AvahiEntryGroup *avahi_entry_group_new(AvahiServer *s, AvahiEntryGroupCallback callback, void* userdata); +AvahiSEntryGroup *avahi_s_entry_group_new(AvahiServer *s, AvahiSEntryGroupCallback callback, void* userdata); /** Free an entry group. All RRs assigned to the group are removed from the server */ -void avahi_entry_group_free(AvahiEntryGroup *g); +void avahi_s_entry_group_free(AvahiSEntryGroup *g); /** Commit an entry group. This starts the probing and registration process for all RRs in the group */ -int avahi_entry_group_commit(AvahiEntryGroup *g); +int avahi_s_entry_group_commit(AvahiSEntryGroup *g); /** Remove all entries from the entry group and reset the state to AVAHI_ENTRY_GROUP_UNCOMMITED. */ -void avahi_entry_group_reset(AvahiEntryGroup *g); +void avahi_s_entry_group_reset(AvahiSEntryGroup *g); /** Return 1 if the entry group is empty, i.e. has no records attached. */ -int avahi_entry_group_is_empty(AvahiEntryGroup *g); +int avahi_s_entry_group_is_empty(AvahiSEntryGroup *g); /** Return the current state of the specified entry group */ -AvahiEntryGroupState avahi_entry_group_get_state(AvahiEntryGroup *g); +AvahiEntryGroupState avahi_s_entry_group_get_state(AvahiSEntryGroup *g); /** Change the opaque user data pointer attached to an entry group object */ -void avahi_entry_group_set_data(AvahiEntryGroup *g, void* userdata); +void avahi_s_entry_group_set_data(AvahiSEntryGroup *g, void* userdata); /** Return the opaque user data pointer currently set for the entry group object */ -void* avahi_entry_group_get_data(AvahiEntryGroup *g); +void* avahi_s_entry_group_get_data(AvahiSEntryGroup *g); /** Add a new resource record to the server. Returns 0 on success, negative otherwise. */ int avahi_server_add( AvahiServer *s, /**< The server object to add this record to */ - AvahiEntryGroup *g, /**< An entry group object if this new record shall be attached to one, or NULL. If you plan to remove the record sometime later you a required to pass an entry group object here. */ + AvahiSEntryGroup *g, /**< An entry group object if this new record shall be attached to one, or NULL. If you plan to remove the record sometime later you a required to pass an entry group object here. */ AvahiIfIndex interface, /**< A numeric index of a network interface to attach this record to, or AVAHI_IF_UNSPEC to attach this record to all interfaces */ AvahiProtocol protocol, /**< A protocol family to attach this record to. One of the AVAHI_PROTO_xxx constants. Use AVAHI_PROTO_UNSPEC to make this record available on all protocols (wich means on both IPv4 and IPv6). */ AvahiEntryFlags flags, /**< Special flags for this record */ @@ -214,7 +211,7 @@ int avahi_server_add( /** Add a PTR RR to the server. See avahi_server_add() for more information. */ int avahi_server_add_ptr( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, AvahiEntryFlags flags, @@ -225,7 +222,7 @@ int avahi_server_add_ptr( /** Add a PTR RR to the server. See avahi_server_add() for more information. */ int avahi_server_add_txt( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, AvahiEntryFlags flags, @@ -238,7 +235,7 @@ int avahi_server_add_txt( * number of arguments */ int avahi_server_add_txt_va( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, AvahiEntryFlags flags, @@ -251,7 +248,7 @@ int avahi_server_add_txt_va( * number of arguments. */ int avahi_server_add_txt_strlst( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, AvahiEntryFlags flags, @@ -264,11 +261,11 @@ int avahi_server_add_txt_strlst( * avahi_server_add() for more information. If adding one of the RRs * fails, the function returns with an error, but it is not defined if * the other RR is deleted from the server or not. Therefore, you have - * to free the AvahiEntryGroup and create a new one before + * to free the AvahiSEntryGroup and create a new one before * proceeding. */ int avahi_server_add_address( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, AvahiEntryFlags flags, @@ -279,11 +276,11 @@ int avahi_server_add_address( * RRs to the server. See avahi_server_add() for more information. If * adding one of the RRs fails, the function returns with an error, * but it is not defined if the other RR is deleted from the server or - * not. Therefore, you have to free the AvahiEntryGroup and create a + * not. Therefore, you have to free the AvahiSEntryGroup and create a * new one before proceeding. */ int avahi_server_add_service( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, /**< Service name, e.g. "Lennart's Files" */ @@ -296,7 +293,7 @@ int avahi_server_add_service( /** Mostly identical to avahi_server_add_service(), but takes an va_list for the TXT records. */ int avahi_server_add_service_va( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, @@ -309,7 +306,7 @@ int avahi_server_add_service_va( /** Mostly identical to avahi_server_add_service(), but takes an AvahiStringList object for the TXT records. The AvahiStringList object is copied. */ int avahi_server_add_service_strlst( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, @@ -327,10 +324,10 @@ typedef enum { /** Publish the specified unicast DNS server address via mDNS. You may * browse for records create this way wit - * avahi_dns_server_browser_new(). */ + * avahi_s_dns_server_browser_new(). */ int avahi_server_add_dns_server_address( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, const char *domain, @@ -343,7 +340,7 @@ host name instead of an address. The specified host name should be resolvable via mDNS */ int avahi_server_add_dns_server_name( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, const char *domain, @@ -352,35 +349,35 @@ int avahi_server_add_dns_server_name( uint16_t port /** should be 53 */); /** A browsing object for arbitrary RRs */ -typedef struct AvahiRecordBrowser AvahiRecordBrowser; +typedef struct AvahiSRecordBrowser AvahiSRecordBrowser; -/** Callback prototype for AvahiRecordBrowser events */ -typedef void (*AvahiRecordBrowserCallback)( - AvahiRecordBrowser *b, /**< The AvahiRecordBrowser object that is emitting this callback */ +/** Callback prototype for AvahiSRecordBrowser events */ +typedef void (*AvahiSRecordBrowserCallback)( + AvahiSRecordBrowser *b, /**< The AvahiSRecordBrowser object that is emitting this callback */ AvahiIfIndex interface, /**< Logical OS network interface number the record was found on */ AvahiProtocol protocol, /**< Protocol number the record was found. */ AvahiBrowserEvent event, /**< Browsing event, either AVAHI_BROWSER_NEW or AVAHI_BROWSER_REMOVE */ AvahiRecord *record, /**< The record that was found */ - void* userdata /**< Arbitrary user data passed to avahi_record_browser_new() */ ); + void* userdata /**< Arbitrary user data passed to avahi_s_record_browser_new() */ ); /** Create a new browsing object for arbitrary RRs */ -AvahiRecordBrowser *avahi_record_browser_new( +AvahiSRecordBrowser *avahi_s_record_browser_new( AvahiServer *server, /**< The server object to which attach this query */ AvahiIfIndex interface, /**< Logical OS interface number where to look for the records, or AVAHI_IF_UNSPEC to look on interfaces */ AvahiProtocol protocol, /**< Protocol number to use when looking for the record, or AVAHI_PROTO_UNSPEC to look on all protocols */ AvahiKey *key, /**< The search key */ - AvahiRecordBrowserCallback callback, /**< The callback to call on browsing events */ + AvahiSRecordBrowserCallback callback, /**< The callback to call on browsing events */ void* userdata /**< Arbitrary use suppliable data which is passed to the callback */); -/** Free an AvahiRecordBrowser object */ -void avahi_record_browser_free(AvahiRecordBrowser *b); +/** Free an AvahiSRecordBrowser object */ +void avahi_s_record_browser_free(AvahiSRecordBrowser *b); /** A host name to IP adddress resolver object */ -typedef struct AvahiHostNameResolver AvahiHostNameResolver; +typedef struct AvahiSHostNameResolver AvahiSHostNameResolver; -/** Callback prototype for AvahiHostNameResolver events */ -typedef void (*AvahiHostNameResolverCallback)( - AvahiHostNameResolver *r, +/** Callback prototype for AvahiSHostNameResolver events */ +typedef void (*AvahiSHostNameResolverCallback)( + AvahiSHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, /**< Resolving event */ @@ -388,25 +385,25 @@ typedef void (*AvahiHostNameResolverCallback)( const AvahiAddress *a, /**< The address, or NULL if the host name couldn't be resolved. */ void* userdata); -/** Create an AvahiHostNameResolver object for resolving a host name to an adddress. See AvahiRecordBrowser for more info on the paramters. */ -AvahiHostNameResolver *avahi_host_name_resolver_new( +/** Create an AvahiSHostNameResolver object for resolving a host name to an adddress. See AvahiSRecordBrowser for more info on the paramters. */ +AvahiSHostNameResolver *avahi_s_host_name_resolver_new( AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const char *host_name, /**< The host name to look for */ AvahiProtocol aprotocol, /**< The address family of the desired address or AVAHI_PROTO_UNSPEC if doesn't matter. */ - AvahiHostNameResolverCallback calback, + AvahiSHostNameResolverCallback calback, void* userdata); -/** Free a AvahiHostNameResolver object */ -void avahi_host_name_resolver_free(AvahiHostNameResolver *r); +/** Free a AvahiSHostNameResolver object */ +void avahi_s_host_name_resolver_free(AvahiSHostNameResolver *r); /** An IP address to host name resolver object ("reverse lookup") */ -typedef struct AvahiAddressResolver AvahiAddressResolver; +typedef struct AvahiSAddressResolver AvahiSAddressResolver; -/** Callback prototype for AvahiAddressResolver events */ -typedef void (*AvahiAddressResolverCallback)( - AvahiAddressResolver *r, +/** Callback prototype for AvahiSAddressResolver events */ +typedef void (*AvahiSAddressResolverCallback)( + AvahiSAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, @@ -414,49 +411,49 @@ typedef void (*AvahiAddressResolverCallback)( const char *host_name, /**< A host name for the specified address, if one was found, i.e. event == AVAHI_RESOLVER_FOUND */ void* userdata); -/** Create an AvahiAddressResolver object. See AvahiRecordBrowser for more info on the paramters. */ -AvahiAddressResolver *avahi_address_resolver_new( +/** Create an AvahiSAddressResolver object. See AvahiSRecordBrowser for more info on the paramters. */ +AvahiSAddressResolver *avahi_s_address_resolver_new( AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const AvahiAddress *address, - AvahiAddressResolverCallback calback, + AvahiSAddressResolverCallback calback, void* userdata); -/** Free an AvahiAddressResolver object */ -void avahi_address_resolver_free(AvahiAddressResolver *r); +/** Free an AvahiSAddressResolver object */ +void avahi_s_address_resolver_free(AvahiSAddressResolver *r); /** A local domain browsing object. May be used to enumerate domains used on the local LAN */ -typedef struct AvahiDomainBrowser AvahiDomainBrowser; +typedef struct AvahiSDomainBrowser AvahiSDomainBrowser; -/** Callback prototype for AvahiDomainBrowser events */ -typedef void (*AvahiDomainBrowserCallback)( - AvahiDomainBrowser *b, +/** Callback prototype for AvahiSDomainBrowser events */ +typedef void (*AvahiSDomainBrowserCallback)( + AvahiSDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *domain, void* userdata); -/** Create a new AvahiDomainBrowser object */ -AvahiDomainBrowser *avahi_domain_browser_new( +/** Create a new AvahiSDomainBrowser object */ +AvahiSDomainBrowser *avahi_s_domain_browser_new( AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const char *domain, AvahiDomainBrowserType type, - AvahiDomainBrowserCallback callback, + AvahiSDomainBrowserCallback callback, void* userdata); -/** Free an AvahiDomainBrowser object */ -void avahi_domain_browser_free(AvahiDomainBrowser *b); +/** Free an AvahiSDomainBrowser object */ +void avahi_s_domain_browser_free(AvahiSDomainBrowser *b); /** A DNS-SD service type browsing object. May be used to enumerate the service types of all available services on the local LAN */ -typedef struct AvahiServiceTypeBrowser AvahiServiceTypeBrowser; +typedef struct AvahiSServiceTypeBrowser AvahiSServiceTypeBrowser; -/** Callback prototype for AvahiServiceTypeBrowser events */ -typedef void (*AvahiServiceTypeBrowserCallback)( - AvahiServiceTypeBrowser *b, +/** Callback prototype for AvahiSServiceTypeBrowser events */ +typedef void (*AvahiSServiceTypeBrowserCallback)( + AvahiSServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, @@ -464,24 +461,24 @@ typedef void (*AvahiServiceTypeBrowserCallback)( const char *domain, void* userdata); -/** Create a new AvahiServiceTypeBrowser object. */ -AvahiServiceTypeBrowser *avahi_service_type_browser_new( +/** Create a new AvahiSServiceTypeBrowser object. */ +AvahiSServiceTypeBrowser *avahi_s_service_type_browser_new( AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const char *domain, - AvahiServiceTypeBrowserCallback callback, + AvahiSServiceTypeBrowserCallback callback, void* userdata); -/** Free an AvahiServiceTypeBrowser object */ -void avahi_service_type_browser_free(AvahiServiceTypeBrowser *b); +/** Free an AvahiSServiceTypeBrowser object */ +void avahi_s_service_type_browser_free(AvahiSServiceTypeBrowser *b); -/** A DNS-SD service browser. Use this to enumerate available services of a certain kind on the local LAN. Use AvahiServiceResolver to get specific service data like address and port for a service. */ -typedef struct AvahiServiceBrowser AvahiServiceBrowser; +/** A DNS-SD service browser. Use this to enumerate available services of a certain kind on the local LAN. Use AvahiSServiceResolver to get specific service data like address and port for a service. */ +typedef struct AvahiSServiceBrowser AvahiSServiceBrowser; -/** Callback prototype for AvahiServiceBrowser events */ -typedef void (*AvahiServiceBrowserCallback)( - AvahiServiceBrowser *b, +/** Callback prototype for AvahiSServiceBrowser events */ +typedef void (*AvahiSServiceBrowserCallback)( + AvahiSServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, @@ -490,25 +487,25 @@ typedef void (*AvahiServiceBrowserCallback)( const char *domain /**< Domain of this service, e.g. "local" */, void* userdata); -/** Create a new AvahiServiceBrowser object. */ -AvahiServiceBrowser *avahi_service_browser_new( +/** Create a new AvahiSServiceBrowser object. */ +AvahiSServiceBrowser *avahi_s_service_browser_new( AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const char *service_type /** DNS-SD service type, e.g. "_http._tcp" */, const char *domain, - AvahiServiceBrowserCallback callback, + AvahiSServiceBrowserCallback callback, void* userdata); -/** Free an AvahiServiceBrowser object */ -void avahi_service_browser_free(AvahiServiceBrowser *b); +/** Free an AvahiSServiceBrowser object */ +void avahi_s_service_browser_free(AvahiSServiceBrowser *b); /** A DNS-SD service resolver. Use this to retrieve addres, port and TXT data for a DNS-SD service */ -typedef struct AvahiServiceResolver AvahiServiceResolver; +typedef struct AvahiSServiceResolver AvahiSServiceResolver; -/** Callback prototype for AvahiServiceResolver events */ -typedef void (*AvahiServiceResolverCallback)( - AvahiServiceResolver *r, +/** Callback prototype for AvahiSServiceResolver events */ +typedef void (*AvahiSServiceResolverCallback)( + AvahiSServiceResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, @@ -521,8 +518,8 @@ typedef void (*AvahiServiceResolverCallback)( AvahiStringList *txt, /**< TXT record data */ void* userdata); -/** Create a new AvahiServiceResolver object */ -AvahiServiceResolver *avahi_service_resolver_new( +/** Create a new AvahiSServiceResolver object */ +AvahiSServiceResolver *avahi_s_service_resolver_new( AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, @@ -530,20 +527,20 @@ AvahiServiceResolver *avahi_service_resolver_new( const char *type, const char *domain, AvahiProtocol aprotocol, /**< Address family of the desired service address. Use AVAHI_PROTO_UNSPEC if you don't care */ - AvahiServiceResolverCallback calback, + AvahiSServiceResolverCallback calback, void* userdata); -/** Free an AvahiServiceResolver object */ -void avahi_service_resolver_free(AvahiServiceResolver *r); +/** Free an AvahiSServiceResolver object */ +void avahi_s_service_resolver_free(AvahiSServiceResolver *r); /** A domain service browser object. Use this to browse for * conventional unicast DNS servers which may be used to resolve * conventional domain names */ -typedef struct AvahiDNSServerBrowser AvahiDNSServerBrowser; +typedef struct AvahiSDNSServerBrowser AvahiSDNSServerBrowser; -/** Callback prototype for AvahiDNSServerBrowser events */ -typedef void (*AvahiDNSServerBrowserCallback)( - AvahiDNSServerBrowser *b, +/** Callback prototype for AvahiSDNSServerBrowser events */ +typedef void (*AvahiSDNSServerBrowserCallback)( + AvahiSDNSServerBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, @@ -552,19 +549,19 @@ typedef void (*AvahiDNSServerBrowserCallback)( uint16_t port, /**< Port number of the DNS servers, probably 53 */ void* userdata); -/** Create a new AvahiDNSServerBrowser object */ -AvahiDNSServerBrowser *avahi_dns_server_browser_new( +/** Create a new AvahiSDNSServerBrowser object */ +AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new( AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const char *domain, AvahiDNSServerType type, AvahiProtocol aprotocol, /**< Address protocol for the DNS server */ - AvahiDNSServerBrowserCallback callback, + AvahiSDNSServerBrowserCallback callback, void* userdata); -/** Free an AvahiDNSServerBrowser object */ -void avahi_dns_server_browser_free(AvahiDNSServerBrowser *b); +/** Free an AvahiSDNSServerBrowser object */ +void avahi_s_dns_server_browser_free(AvahiSDNSServerBrowser *b); /** Return the last error code */ int avahi_server_errno(AvahiServer *s); diff --git a/avahi-core/iface.c b/avahi-core/iface.c index 8671044..81b8375 100644 --- a/avahi-core/iface.c +++ b/avahi-core/iface.c @@ -54,32 +54,32 @@ static void update_address_rr(AvahiInterfaceMonitor *m, AvahiInterfaceAddress *a /* Fill the entry group */ if (!a->entry_group) - a->entry_group = avahi_entry_group_new(m->server, avahi_host_rr_entry_group_callback, NULL); + a->entry_group = avahi_s_entry_group_new(m->server, avahi_host_rr_entry_group_callback, NULL); if (!a->entry_group) /* OOM */ return; - if (avahi_entry_group_is_empty(a->entry_group)) { + if (avahi_s_entry_group_is_empty(a->entry_group)) { if (avahi_server_add_address(m->server, a->entry_group, a->interface->hardware->index, a->interface->protocol, 0, NULL, &a->address) < 0) { avahi_log_warn(__FILE__": avahi_server_add_address() failed: %s", avahi_strerror(m->server->error)); - avahi_entry_group_free(a->entry_group); + avahi_s_entry_group_free(a->entry_group); a->entry_group = NULL; return; } - avahi_entry_group_commit(a->entry_group); + avahi_s_entry_group_commit(a->entry_group); } } else { /* Clear the entry group */ - if (a->entry_group && !avahi_entry_group_is_empty(a->entry_group)) { + if (a->entry_group && !avahi_s_entry_group_is_empty(a->entry_group)) { - if (avahi_entry_group_get_state(a->entry_group) == AVAHI_ENTRY_GROUP_REGISTERING) + if (avahi_s_entry_group_get_state(a->entry_group) == AVAHI_ENTRY_GROUP_REGISTERING) avahi_server_decrease_host_rr_pending(m->server); - avahi_entry_group_reset(a->entry_group); + avahi_s_entry_group_reset(a->entry_group); } } } @@ -109,12 +109,12 @@ static void update_hw_interface_rr(AvahiInterfaceMonitor *m, AvahiHwInterface *h m->server->state == AVAHI_SERVER_REGISTERING)) { if (!hw->entry_group) - hw->entry_group = avahi_entry_group_new(m->server, avahi_host_rr_entry_group_callback, NULL); + hw->entry_group = avahi_s_entry_group_new(m->server, avahi_host_rr_entry_group_callback, NULL); if (!hw->entry_group) return; /* OOM */ - if (avahi_entry_group_is_empty(hw->entry_group)) { + if (avahi_s_entry_group_is_empty(hw->entry_group)) { char *name; char *t; @@ -129,22 +129,22 @@ static void update_hw_interface_rr(AvahiInterfaceMonitor *m, AvahiHwInterface *h if (avahi_server_add_service(m->server, hw->entry_group, hw->index, AVAHI_PROTO_UNSPEC, name, "_workstation._tcp", NULL, NULL, 9, NULL) < 0) { avahi_log_warn(__FILE__": avahi_server_add_service() failed."); - avahi_entry_group_free(hw->entry_group); + avahi_s_entry_group_free(hw->entry_group); hw->entry_group = NULL; } else - avahi_entry_group_commit(hw->entry_group); + avahi_s_entry_group_commit(hw->entry_group); avahi_free(name); } } else { - if (hw->entry_group && !avahi_entry_group_is_empty(hw->entry_group)) { + if (hw->entry_group && !avahi_s_entry_group_is_empty(hw->entry_group)) { - if (avahi_entry_group_get_state(hw->entry_group) == AVAHI_ENTRY_GROUP_REGISTERING) + if (avahi_s_entry_group_get_state(hw->entry_group) == AVAHI_ENTRY_GROUP_REGISTERING) avahi_server_decrease_host_rr_pending(m->server); - avahi_entry_group_reset(hw->entry_group); + avahi_s_entry_group_reset(hw->entry_group); } } } @@ -158,7 +158,7 @@ static void free_address(AvahiInterfaceMonitor *m, AvahiInterfaceAddress *a) { AVAHI_LLIST_REMOVE(AvahiInterfaceAddress, address, a->interface->addresses, a); if (a->entry_group) - avahi_entry_group_free(a->entry_group); + avahi_s_entry_group_free(a->entry_group); avahi_free(a); } @@ -198,7 +198,7 @@ static void free_hw_interface(AvahiInterfaceMonitor *m, AvahiHwInterface *hw, in free_interface(m, hw->interfaces, send_goodbye); if (hw->entry_group) - avahi_entry_group_free(hw->entry_group); + avahi_s_entry_group_free(hw->entry_group); AVAHI_LLIST_REMOVE(AvahiHwInterface, hardware, m->hw_interfaces, hw); avahi_hashmap_remove(m->hashmap, &hw->index); diff --git a/avahi-core/iface.h b/avahi-core/iface.h index 627e13d..c913a2e 100644 --- a/avahi-core/iface.h +++ b/avahi-core/iface.h @@ -70,7 +70,7 @@ struct AvahiHwInterface { uint8_t mac_address[AVAHI_MAX_MAC_ADDRESS]; size_t mac_address_size; - AvahiEntryGroup *entry_group; + AvahiSEntryGroup *entry_group; AVAHI_LLIST_HEAD(AvahiInterface, interfaces); }; @@ -102,7 +102,7 @@ struct AvahiInterfaceAddress { unsigned char prefix_len; AvahiAddress address; - AvahiEntryGroup *entry_group; + AvahiSEntryGroup *entry_group; AvahiInterface *interface; }; diff --git a/avahi-core/resolve-address.c b/avahi-core/resolve-address.c index e210285..d46483e 100644 --- a/avahi-core/resolve-address.c +++ b/avahi-core/resolve-address.c @@ -28,24 +28,24 @@ #include "browse.h" -struct AvahiAddressResolver { +struct AvahiSAddressResolver { AvahiServer *server; AvahiAddress address; - AvahiRecordBrowser *record_browser; + AvahiSRecordBrowser *record_browser; - AvahiAddressResolverCallback callback; + AvahiSAddressResolverCallback callback; void* userdata; AvahiTimeEvent *time_event; - AVAHI_LLIST_FIELDS(AvahiAddressResolver, resolver); + AVAHI_LLIST_FIELDS(AvahiSAddressResolver, resolver); }; -static void finish(AvahiAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, AvahiRecord *record) { +static void finish(AvahiSAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, AvahiRecord *record) { assert(r); - avahi_record_browser_free(r->record_browser); + avahi_s_record_browser_free(r->record_browser); r->record_browser = NULL; if (r->time_event) { @@ -56,8 +56,8 @@ static void finish(AvahiAddressResolver *r, AvahiIfIndex interface, AvahiProtoco r->callback(r, interface, protocol, event, &r->address, record ? record->data.ptr.name : NULL, r->userdata); } -static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, void* userdata) { - AvahiAddressResolver *r = userdata; +static void record_browser_callback(AvahiSRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, void* userdata) { + AvahiSAddressResolver *r = userdata; assert(rr); assert(record); @@ -72,7 +72,7 @@ static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interfac } static void time_event_callback(AvahiTimeEvent *e, void *userdata) { - AvahiAddressResolver *r = userdata; + AvahiSAddressResolver *r = userdata; assert(e); assert(r); @@ -80,8 +80,8 @@ static void time_event_callback(AvahiTimeEvent *e, void *userdata) { finish(r, -1, AVAHI_PROTO_UNSPEC, AVAHI_RESOLVER_TIMEOUT, NULL); } -AvahiAddressResolver *avahi_address_resolver_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const AvahiAddress *address, AvahiAddressResolverCallback callback, void* userdata) { - AvahiAddressResolver *r; +AvahiSAddressResolver *avahi_s_address_resolver_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const AvahiAddress *address, AvahiSAddressResolverCallback callback, void* userdata) { + AvahiSAddressResolver *r; AvahiKey *k; char *n; struct timeval tv; @@ -110,7 +110,7 @@ AvahiAddressResolver *avahi_address_resolver_new(AvahiServer *server, AvahiIfInd return NULL; } - if (!(r = avahi_new(AvahiAddressResolver, 1))) { + if (!(r = avahi_new(AvahiSAddressResolver, 1))) { avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY); avahi_key_unref(k); return NULL; @@ -122,34 +122,34 @@ AvahiAddressResolver *avahi_address_resolver_new(AvahiServer *server, AvahiIfInd r->userdata = userdata; r->record_browser = NULL; - AVAHI_LLIST_PREPEND(AvahiAddressResolver, resolver, server->address_resolvers, r); + AVAHI_LLIST_PREPEND(AvahiSAddressResolver, resolver, server->address_resolvers, r); avahi_elapse_time(&tv, 1000, 0); if (!(r->time_event = avahi_time_event_new(server->time_event_queue, &tv, time_event_callback, r))) { avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY); - avahi_address_resolver_free(r); + avahi_s_address_resolver_free(r); avahi_key_unref(k); return NULL; } - r->record_browser = avahi_record_browser_new(server, interface, protocol, k, record_browser_callback, r); + r->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, record_browser_callback, r); avahi_key_unref(k); if (!r->record_browser) { - avahi_address_resolver_free(r); + avahi_s_address_resolver_free(r); return NULL; } return r; } -void avahi_address_resolver_free(AvahiAddressResolver *r) { +void avahi_s_address_resolver_free(AvahiSAddressResolver *r) { assert(r); - AVAHI_LLIST_REMOVE(AvahiAddressResolver, resolver, r->server->address_resolvers, r); + AVAHI_LLIST_REMOVE(AvahiSAddressResolver, resolver, r->server->address_resolvers, r); if (r->record_browser) - avahi_record_browser_free(r->record_browser); + avahi_s_record_browser_free(r->record_browser); if (r->time_event) avahi_time_event_free(r->time_event); diff --git a/avahi-core/resolve-host-name.c b/avahi-core/resolve-host-name.c index 5ea1697..f25c4b1 100644 --- a/avahi-core/resolve-host-name.c +++ b/avahi-core/resolve-host-name.c @@ -30,33 +30,33 @@ #include "browse.h" #include "log.h" -struct AvahiHostNameResolver { +struct AvahiSHostNameResolver { AvahiServer *server; char *host_name; - AvahiRecordBrowser *record_browser_a; - AvahiRecordBrowser *record_browser_aaaa; + AvahiSRecordBrowser *record_browser_a; + AvahiSRecordBrowser *record_browser_aaaa; - AvahiHostNameResolverCallback callback; + AvahiSHostNameResolverCallback callback; void* userdata; AvahiTimeEvent *time_event; - AVAHI_LLIST_FIELDS(AvahiHostNameResolver, resolver); + AVAHI_LLIST_FIELDS(AvahiSHostNameResolver, resolver); }; -static void finish(AvahiHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, AvahiRecord *record) { +static void finish(AvahiSHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, AvahiRecord *record) { AvahiAddress a; assert(r); if (r->record_browser_a) { - avahi_record_browser_free(r->record_browser_a); + avahi_s_record_browser_free(r->record_browser_a); r->record_browser_a = NULL; } if (r->record_browser_aaaa) { - avahi_record_browser_free(r->record_browser_aaaa); + avahi_s_record_browser_free(r->record_browser_aaaa); r->record_browser_aaaa = NULL; } @@ -85,8 +85,8 @@ static void finish(AvahiHostNameResolver *r, AvahiIfIndex interface, AvahiProtoc r->callback(r, interface, protocol, event, record ? record->key->name : r->host_name, record ? &a : NULL, r->userdata); } -static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, void* userdata) { - AvahiHostNameResolver *r = userdata; +static void record_browser_callback(AvahiSRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, void* userdata) { + AvahiSHostNameResolver *r = userdata; assert(rr); assert(record); @@ -100,7 +100,7 @@ static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interfac } static void time_event_callback(AvahiTimeEvent *e, void *userdata) { - AvahiHostNameResolver *r = userdata; + AvahiSHostNameResolver *r = userdata; assert(e); assert(r); @@ -108,8 +108,8 @@ static void time_event_callback(AvahiTimeEvent *e, void *userdata) { finish(r, -1, AVAHI_PROTO_UNSPEC, AVAHI_RESOLVER_TIMEOUT, NULL); } -AvahiHostNameResolver *avahi_host_name_resolver_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const char *host_name, AvahiProtocol aprotocol, AvahiHostNameResolverCallback callback, void* userdata) { - AvahiHostNameResolver *r; +AvahiSHostNameResolver *avahi_s_host_name_resolver_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const char *host_name, AvahiProtocol aprotocol, AvahiSHostNameResolverCallback callback, void* userdata) { + AvahiSHostNameResolver *r; AvahiKey *k; struct timeval tv; @@ -124,7 +124,7 @@ AvahiHostNameResolver *avahi_host_name_resolver_new(AvahiServer *server, AvahiIf return NULL; } - if (!(r = avahi_new(AvahiHostNameResolver, 1))) { + if (!(r = avahi_new(AvahiSHostNameResolver, 1))) { avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY); return NULL; } @@ -139,13 +139,13 @@ AvahiHostNameResolver *avahi_host_name_resolver_new(AvahiServer *server, AvahiIf avahi_elapse_time(&tv, 1000, 0); r->time_event = avahi_time_event_new(server->time_event_queue, &tv, time_event_callback, r); - AVAHI_LLIST_PREPEND(AvahiHostNameResolver, resolver, server->host_name_resolvers, r); + AVAHI_LLIST_PREPEND(AvahiSHostNameResolver, resolver, server->host_name_resolvers, r); r->record_browser_aaaa = r->record_browser_a = NULL; if (aprotocol == AVAHI_PROTO_INET || aprotocol == AVAHI_PROTO_UNSPEC) { k = avahi_key_new(host_name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_A); - r->record_browser_a = avahi_record_browser_new(server, interface, protocol, k, record_browser_callback, r); + r->record_browser_a = avahi_s_record_browser_new(server, interface, protocol, k, record_browser_callback, r); avahi_key_unref(k); if (!r->record_browser_a) @@ -154,7 +154,7 @@ AvahiHostNameResolver *avahi_host_name_resolver_new(AvahiServer *server, AvahiIf if (aprotocol == AVAHI_PROTO_INET6 || aprotocol == AVAHI_PROTO_UNSPEC) { k = avahi_key_new(host_name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_AAAA); - r->record_browser_aaaa = avahi_record_browser_new(server, interface, protocol, k, record_browser_callback, r); + r->record_browser_aaaa = avahi_s_record_browser_new(server, interface, protocol, k, record_browser_callback, r); avahi_key_unref(k); if (!r->record_browser_aaaa) @@ -166,20 +166,20 @@ AvahiHostNameResolver *avahi_host_name_resolver_new(AvahiServer *server, AvahiIf return r; fail: - avahi_host_name_resolver_free(r); + avahi_s_host_name_resolver_free(r); return NULL; } -void avahi_host_name_resolver_free(AvahiHostNameResolver *r) { +void avahi_s_host_name_resolver_free(AvahiSHostNameResolver *r) { assert(r); - AVAHI_LLIST_REMOVE(AvahiHostNameResolver, resolver, r->server->host_name_resolvers, r); + AVAHI_LLIST_REMOVE(AvahiSHostNameResolver, resolver, r->server->host_name_resolvers, r); if (r->record_browser_a) - avahi_record_browser_free(r->record_browser_a); + avahi_s_record_browser_free(r->record_browser_a); if (r->record_browser_aaaa) - avahi_record_browser_free(r->record_browser_aaaa); + avahi_s_record_browser_free(r->record_browser_aaaa); if (r->time_event) avahi_time_event_free(r->time_event); diff --git a/avahi-core/resolve-service.c b/avahi-core/resolve-service.c index 194c245..4a19942 100644 --- a/avahi-core/resolve-service.c +++ b/avahi-core/resolve-service.c @@ -32,7 +32,7 @@ #include "browse.h" -struct AvahiServiceResolver { +struct AvahiSServiceResolver { AvahiServer *server; char *service_name; char *service_type; @@ -42,41 +42,41 @@ struct AvahiServiceResolver { AvahiIfIndex interface; AvahiProtocol protocol; - AvahiRecordBrowser *record_browser_srv; - AvahiRecordBrowser *record_browser_txt; - AvahiRecordBrowser *record_browser_a; - AvahiRecordBrowser *record_browser_aaaa; + AvahiSRecordBrowser *record_browser_srv; + AvahiSRecordBrowser *record_browser_txt; + AvahiSRecordBrowser *record_browser_a; + AvahiSRecordBrowser *record_browser_aaaa; AvahiRecord *srv_record, *txt_record, *address_record; - AvahiServiceResolverCallback callback; + AvahiSServiceResolverCallback callback; void* userdata; AvahiTimeEvent *time_event; - AVAHI_LLIST_FIELDS(AvahiServiceResolver, resolver); + AVAHI_LLIST_FIELDS(AvahiSServiceResolver, resolver); }; -static void finish(AvahiServiceResolver *r, AvahiResolverEvent event) { +static void finish(AvahiSServiceResolver *r, AvahiResolverEvent event) { assert(r); if (r->record_browser_a) { - avahi_record_browser_free(r->record_browser_a); + avahi_s_record_browser_free(r->record_browser_a); r->record_browser_a = NULL; } if (r->record_browser_aaaa) { - avahi_record_browser_free(r->record_browser_aaaa); + avahi_s_record_browser_free(r->record_browser_aaaa); r->record_browser_aaaa = NULL; } if (r->record_browser_srv) { - avahi_record_browser_free(r->record_browser_srv); + avahi_s_record_browser_free(r->record_browser_srv); r->record_browser_srv = NULL; } if (r->record_browser_txt) { - avahi_record_browser_free(r->record_browser_txt); + avahi_s_record_browser_free(r->record_browser_txt); r->record_browser_txt = NULL; } @@ -125,8 +125,8 @@ static void finish(AvahiServiceResolver *r, AvahiResolverEvent event) { } } -static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, void* userdata) { - AvahiServiceResolver *r = userdata; +static void record_browser_callback(AvahiSRecordBrowser*rr, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, void* userdata) { + AvahiSServiceResolver *r = userdata; assert(rr); assert(record); @@ -156,13 +156,13 @@ static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interfac if (r->address_protocol == AVAHI_PROTO_INET || r->address_protocol == AVAHI_PROTO_UNSPEC) { AvahiKey *k = avahi_key_new(r->srv_record->data.srv.name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_A); - r->record_browser_a = avahi_record_browser_new(r->server, r->interface, r->protocol, k, record_browser_callback, r); + r->record_browser_a = avahi_s_record_browser_new(r->server, r->interface, r->protocol, k, record_browser_callback, r); avahi_key_unref(k); } if (r->address_protocol == AVAHI_PROTO_INET6 || r->address_protocol == AVAHI_PROTO_UNSPEC) { AvahiKey *k = avahi_key_new(r->srv_record->data.srv.name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_AAAA); - r->record_browser_aaaa = avahi_record_browser_new(r->server, r->interface, r->protocol, k, record_browser_callback, r); + r->record_browser_aaaa = avahi_s_record_browser_new(r->server, r->interface, r->protocol, k, record_browser_callback, r); avahi_key_unref(k); } } @@ -188,7 +188,7 @@ static void record_browser_callback(AvahiRecordBrowser*rr, AvahiIfIndex interfac } static void time_event_callback(AvahiTimeEvent *e, void *userdata) { - AvahiServiceResolver *r = userdata; + AvahiSServiceResolver *r = userdata; assert(e); assert(r); @@ -196,8 +196,8 @@ static void time_event_callback(AvahiTimeEvent *e, void *userdata) { finish(r, AVAHI_RESOLVER_TIMEOUT); } -AvahiServiceResolver *avahi_service_resolver_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain, AvahiProtocol aprotocol, AvahiServiceResolverCallback callback, void* userdata) { - AvahiServiceResolver *r; +AvahiSServiceResolver *avahi_s_service_resolver_new(AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain, AvahiProtocol aprotocol, AvahiSServiceResolverCallback callback, void* userdata) { + AvahiSServiceResolver *r; AvahiKey *k; struct timeval tv; char t[256], *n; @@ -225,7 +225,7 @@ AvahiServiceResolver *avahi_service_resolver_new(AvahiServer *server, AvahiIfInd return NULL; } - if (!(r = avahi_new(AvahiServiceResolver, 1))) { + if (!(r = avahi_new(AvahiSServiceResolver, 1))) { avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY); return NULL; } @@ -249,47 +249,47 @@ AvahiServiceResolver *avahi_service_resolver_new(AvahiServer *server, AvahiIfInd avahi_elapse_time(&tv, 1000, 0); r->time_event = avahi_time_event_new(server->time_event_queue, &tv, time_event_callback, r); - AVAHI_LLIST_PREPEND(AvahiServiceResolver, resolver, server->service_resolvers, r); + AVAHI_LLIST_PREPEND(AvahiSServiceResolver, resolver, server->service_resolvers, r); r->record_browser_a = r->record_browser_aaaa = r->record_browser_srv = r->record_browser_txt = NULL; k = avahi_key_new(t, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV); - r->record_browser_srv = avahi_record_browser_new(server, interface, protocol, k, record_browser_callback, r); + r->record_browser_srv = avahi_s_record_browser_new(server, interface, protocol, k, record_browser_callback, r); avahi_key_unref(k); if (!r->record_browser_srv) { - avahi_service_resolver_free(r); + avahi_s_service_resolver_free(r); return NULL; } k = avahi_key_new(t, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_TXT); - r->record_browser_txt = avahi_record_browser_new(server, interface, protocol, k, record_browser_callback, r); + r->record_browser_txt = avahi_s_record_browser_new(server, interface, protocol, k, record_browser_callback, r); avahi_key_unref(k); if (!r->record_browser_txt) { - avahi_service_resolver_free(r); + avahi_s_service_resolver_free(r); return NULL; } return r; } -void avahi_service_resolver_free(AvahiServiceResolver *r) { +void avahi_s_service_resolver_free(AvahiSServiceResolver *r) { assert(r); - AVAHI_LLIST_REMOVE(AvahiServiceResolver, resolver, r->server->service_resolvers, r); + AVAHI_LLIST_REMOVE(AvahiSServiceResolver, resolver, r->server->service_resolvers, r); if (r->time_event) avahi_time_event_free(r->time_event); if (r->record_browser_srv) - avahi_record_browser_free(r->record_browser_srv); + avahi_s_record_browser_free(r->record_browser_srv); if (r->record_browser_txt) - avahi_record_browser_free(r->record_browser_txt); + avahi_s_record_browser_free(r->record_browser_txt); if (r->record_browser_a) - avahi_record_browser_free(r->record_browser_a); + avahi_s_record_browser_free(r->record_browser_a); if (r->record_browser_aaaa) - avahi_record_browser_free(r->record_browser_aaaa); + avahi_s_record_browser_free(r->record_browser_aaaa); if (r->srv_record) avahi_record_unref(r->srv_record); diff --git a/avahi-core/server.c b/avahi-core/server.c index a3fac4b..ae0b1e6 100644 --- a/avahi-core/server.c +++ b/avahi-core/server.c @@ -74,7 +74,7 @@ static void free_entry(AvahiServer*s, AvahiEntry *e) { avahi_free(e); } -static void free_group(AvahiServer *s, AvahiEntryGroup *g) { +static void free_group(AvahiServer *s, AvahiSEntryGroup *g) { assert(s); assert(g); @@ -84,7 +84,7 @@ static void free_group(AvahiServer *s, AvahiEntryGroup *g) { if (g->register_time_event) avahi_time_event_free(g->register_time_event); - AVAHI_LLIST_REMOVE(AvahiEntryGroup, groups, s->groups, g); + AVAHI_LLIST_REMOVE(AvahiSEntryGroup, groups, s->groups, g); avahi_free(g); } @@ -92,7 +92,7 @@ static void cleanup_dead(AvahiServer *s) { assert(s); if (s->need_group_cleanup) { - AvahiEntryGroup *g, *next; + AvahiSEntryGroup *g, *next; for (g = s->groups; g; g = next) { next = g->groups_next; @@ -212,7 +212,7 @@ static void withdraw_entry(AvahiServer *s, AvahiEntry *e) { e->group->n_probing = 0; - avahi_entry_group_change_state(e->group, AVAHI_ENTRY_GROUP_COLLISION); + avahi_s_entry_group_change_state(e->group, AVAHI_ENTRY_GROUP_COLLISION); } else { avahi_goodbye_entry(s, e, 0); e->dead = 1; @@ -1081,10 +1081,10 @@ static void withdraw_host_rrs(AvahiServer *s) { assert(s); if (s->hinfo_entry_group) - avahi_entry_group_reset(s->hinfo_entry_group); + avahi_s_entry_group_reset(s->hinfo_entry_group); if (s->browse_domain_entry_group) - avahi_entry_group_reset(s->browse_domain_entry_group); + avahi_s_entry_group_reset(s->browse_domain_entry_group); avahi_update_host_rrs(s->monitor, 1); s->n_host_rr_pending = 0; @@ -1105,7 +1105,7 @@ void avahi_server_increase_host_rr_pending(AvahiServer *s) { s->n_host_rr_pending ++; } -void avahi_host_rr_entry_group_callback(AvahiServer *s, AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) { +void avahi_host_rr_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void *userdata) { assert(s); assert(g); @@ -1133,9 +1133,9 @@ static void register_hinfo(AvahiServer *s) { return; if (s->hinfo_entry_group) - assert(avahi_entry_group_is_empty(s->hinfo_entry_group)); + assert(avahi_s_entry_group_is_empty(s->hinfo_entry_group)); else - s->hinfo_entry_group = avahi_entry_group_new(s, avahi_host_rr_entry_group_callback, NULL); + s->hinfo_entry_group = avahi_s_entry_group_new(s, avahi_host_rr_entry_group_callback, NULL); if (!s->hinfo_entry_group) { avahi_log_warn("Failed to create HINFO entry group: %s", avahi_strerror(s->error)); @@ -1156,7 +1156,7 @@ static void register_hinfo(AvahiServer *s) { avahi_record_unref(r); } - if (avahi_entry_group_commit(s->hinfo_entry_group) < 0) + if (avahi_s_entry_group_commit(s->hinfo_entry_group) < 0) avahi_log_warn("Failed to commit HINFO entry group: %s", avahi_strerror(s->error)); } @@ -1180,9 +1180,9 @@ static void register_browse_domain(AvahiServer *s) { return; if (s->browse_domain_entry_group) - assert(avahi_entry_group_is_empty(s->browse_domain_entry_group)); + assert(avahi_s_entry_group_is_empty(s->browse_domain_entry_group)); else - s->browse_domain_entry_group = avahi_entry_group_new(s, NULL, NULL); + s->browse_domain_entry_group = avahi_s_entry_group_new(s, NULL, NULL); if (!s->browse_domain_entry_group) { avahi_log_warn("Failed to create browse domain entry group: %s", avahi_strerror(s->error)); @@ -1194,7 +1194,7 @@ static void register_browse_domain(AvahiServer *s) { return; } - if (avahi_entry_group_commit(s->browse_domain_entry_group) < 0) + if (avahi_s_entry_group_commit(s->browse_domain_entry_group) < 0) avahi_log_warn("Failed to commit browse domain entry group: %s", avahi_strerror(s->error)); } @@ -1350,14 +1350,14 @@ AvahiServer *avahi_server_new(AvahiPoll *poll_api, const AvahiServerConfig *sc, AVAHI_LLIST_HEAD_INIT(AvahiGroup, s->groups); s->record_browser_hashmap = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, NULL, NULL); - AVAHI_LLIST_HEAD_INIT(AvahiRecordBrowser, s->record_browsers); - AVAHI_LLIST_HEAD_INIT(AvahiHostNameResolver, s->host_name_resolvers); - AVAHI_LLIST_HEAD_INIT(AvahiAddressResolver, s->address_resolvers); - AVAHI_LLIST_HEAD_INIT(AvahiDomainBrowser, s->domain_browsers); - AVAHI_LLIST_HEAD_INIT(AvahiServiceTypeBrowser, s->service_type_browsers); - AVAHI_LLIST_HEAD_INIT(AvahiServiceBrowser, s->service_browsers); - AVAHI_LLIST_HEAD_INIT(AvahiServiceResolver, s->service_resolvers); - AVAHI_LLIST_HEAD_INIT(AvahiDNSServerBrowser, s->dns_server_browsers); + AVAHI_LLIST_HEAD_INIT(AvahiSRecordBrowser, s->record_browsers); + AVAHI_LLIST_HEAD_INIT(AvahiSHostNameResolver, s->host_name_resolvers); + AVAHI_LLIST_HEAD_INIT(AvahiSAddressResolver, s->address_resolvers); + AVAHI_LLIST_HEAD_INIT(AvahiSDomainBrowser, s->domain_browsers); + AVAHI_LLIST_HEAD_INIT(AvahiSServiceTypeBrowser, s->service_type_browsers); + AVAHI_LLIST_HEAD_INIT(AvahiSServiceBrowser, s->service_browsers); + AVAHI_LLIST_HEAD_INIT(AvahiSServiceResolver, s->service_resolvers); + AVAHI_LLIST_HEAD_INIT(AvahiSDNSServerBrowser, s->dns_server_browsers); s->legacy_unicast_reflect_slots = NULL; s->legacy_unicast_reflect_id = 0; @@ -1401,21 +1401,21 @@ void avahi_server_free(AvahiServer* s) { free_slots(s); while (s->dns_server_browsers) - avahi_dns_server_browser_free(s->dns_server_browsers); + avahi_s_dns_server_browser_free(s->dns_server_browsers); while (s->host_name_resolvers) - avahi_host_name_resolver_free(s->host_name_resolvers); + avahi_s_host_name_resolver_free(s->host_name_resolvers); while (s->address_resolvers) - avahi_address_resolver_free(s->address_resolvers); + avahi_s_address_resolver_free(s->address_resolvers); while (s->domain_browsers) - avahi_domain_browser_free(s->domain_browsers); + avahi_s_domain_browser_free(s->domain_browsers); while (s->service_type_browsers) - avahi_service_type_browser_free(s->service_type_browsers); + avahi_s_service_type_browser_free(s->service_type_browsers); while (s->service_browsers) - avahi_service_browser_free(s->service_browsers); + avahi_s_service_browser_free(s->service_browsers); while (s->service_resolvers) - avahi_service_resolver_free(s->service_resolvers); + avahi_s_service_resolver_free(s->service_resolvers); while (s->record_browsers) - avahi_record_browser_destroy(s->record_browsers); + avahi_s_record_browser_destroy(s->record_browsers); avahi_hashmap_free(s->record_browser_hashmap); avahi_hashmap_free(s->entries_by_key); @@ -1483,7 +1483,7 @@ static int check_record_conflict(AvahiServer *s, AvahiIfIndex interface, AvahiPr int avahi_server_add( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, AvahiEntryFlags flags, @@ -1535,7 +1535,7 @@ int avahi_server_add( return 0; } -const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiEntryGroup *g, void **state) { +const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiSEntryGroup *g, void **state) { AvahiEntry **e = (AvahiEntry**) state; assert(s); assert(e); @@ -1582,7 +1582,7 @@ int avahi_server_dump(AvahiServer *s, AvahiDumpCallback callback, void* userdata int avahi_server_add_ptr( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, AvahiEntryFlags flags, @@ -1607,7 +1607,7 @@ int avahi_server_add_ptr( int avahi_server_add_address( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, AvahiEntryFlags flags, @@ -1703,7 +1703,7 @@ fail: static int server_add_txt_strlst_nocopy( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, AvahiEntryFlags flags, @@ -1728,7 +1728,7 @@ static int server_add_txt_strlst_nocopy( int avahi_server_add_txt_strlst( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, AvahiEntryFlags flags, @@ -1743,7 +1743,7 @@ int avahi_server_add_txt_strlst( int avahi_server_add_txt_va( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, AvahiEntryFlags flags, @@ -1758,7 +1758,7 @@ int avahi_server_add_txt_va( int avahi_server_add_txt( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, AvahiEntryFlags flags, @@ -1802,7 +1802,7 @@ static void escape_service_name(char *d, size_t size, const char *s) { static int server_add_service_strlst_nocopy( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, @@ -1895,7 +1895,7 @@ fail: int avahi_server_add_service_strlst( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, @@ -1914,7 +1914,7 @@ int avahi_server_add_service_strlst( int avahi_server_add_service_va( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, @@ -1933,7 +1933,7 @@ int avahi_server_add_service_va( int avahi_server_add_service( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, @@ -1980,7 +1980,7 @@ static void hexstring(char *s, size_t sl, const void *p, size_t pl) { int avahi_server_add_dns_server_address( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, const char *domain, @@ -2027,7 +2027,7 @@ int avahi_server_add_dns_server_address( int avahi_server_add_dns_server_name( AvahiServer *s, - AvahiEntryGroup *g, + AvahiSEntryGroup *g, AvahiIfIndex interface, AvahiProtocol protocol, const char *domain, @@ -2098,7 +2098,7 @@ void avahi_server_post_query(AvahiServer *s, AvahiIfIndex interface, AvahiProtoc avahi_interface_monitor_walk(s->monitor, interface, protocol, post_query_callback, key); } -void avahi_entry_group_change_state(AvahiEntryGroup *g, AvahiEntryGroupState state) { +void avahi_s_entry_group_change_state(AvahiSEntryGroup *g, AvahiEntryGroupState state) { assert(g); if (g->state == state) @@ -2112,12 +2112,12 @@ void avahi_entry_group_change_state(AvahiEntryGroup *g, AvahiEntryGroupState sta g->callback(g->server, g, state, g->userdata); } -AvahiEntryGroup *avahi_entry_group_new(AvahiServer *s, AvahiEntryGroupCallback callback, void* userdata) { - AvahiEntryGroup *g; +AvahiSEntryGroup *avahi_s_entry_group_new(AvahiServer *s, AvahiSEntryGroupCallback callback, void* userdata) { + AvahiSEntryGroup *g; assert(s); - if (!(g = avahi_new(AvahiEntryGroup, 1))) { + if (!(g = avahi_new(AvahiSEntryGroup, 1))) { avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY); return NULL; } @@ -2134,11 +2134,11 @@ AvahiEntryGroup *avahi_entry_group_new(AvahiServer *s, AvahiEntryGroupCallback c g->register_time.tv_usec = 0; AVAHI_LLIST_HEAD_INIT(AvahiEntry, g->entries); - AVAHI_LLIST_PREPEND(AvahiEntryGroup, groups, s->groups, g); + AVAHI_LLIST_PREPEND(AvahiSEntryGroup, groups, s->groups, g); return g; } -void avahi_entry_group_free(AvahiEntryGroup *g) { +void avahi_s_entry_group_free(AvahiSEntryGroup *g) { AvahiEntry *e; assert(g); @@ -2162,21 +2162,21 @@ void avahi_entry_group_free(AvahiEntryGroup *g) { g->server->need_entry_cleanup = 1; } -static void entry_group_commit_real(AvahiEntryGroup *g) { +static void entry_group_commit_real(AvahiSEntryGroup *g) { assert(g); gettimeofday(&g->register_time, NULL); - avahi_entry_group_change_state(g, AVAHI_ENTRY_GROUP_REGISTERING); + avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_REGISTERING); if (!g->dead) { avahi_announce_group(g->server, g); - avahi_entry_group_check_probed(g, 0); + avahi_s_entry_group_check_probed(g, 0); } } static void entry_group_register_time_event_callback(AvahiTimeEvent *e, void* userdata) { - AvahiEntryGroup *g = userdata; + AvahiSEntryGroup *g = userdata; assert(g); /* avahi_log_debug("Holdoff passed, waking up and going on."); */ @@ -2188,7 +2188,7 @@ static void entry_group_register_time_event_callback(AvahiTimeEvent *e, void* us entry_group_commit_real(g); } -int avahi_entry_group_commit(AvahiEntryGroup *g) { +int avahi_s_entry_group_commit(AvahiSEntryGroup *g) { struct timeval now; assert(g); @@ -2218,13 +2218,13 @@ int avahi_entry_group_commit(AvahiEntryGroup *g) { assert(!g->register_time_event); g->register_time_event = avahi_time_event_new(g->server->time_event_queue, &g->register_time, entry_group_register_time_event_callback, g); - avahi_entry_group_change_state(g, AVAHI_ENTRY_GROUP_REGISTERING); + avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_REGISTERING); } return AVAHI_OK; } -void avahi_entry_group_reset(AvahiEntryGroup *g) { +void avahi_s_entry_group_reset(AvahiSEntryGroup *g) { AvahiEntry *e; assert(g); @@ -2248,7 +2248,7 @@ void avahi_entry_group_reset(AvahiEntryGroup *g) { g->server->need_entry_cleanup = 1; g->n_probing = 0; - avahi_entry_group_change_state(g, AVAHI_ENTRY_GROUP_UNCOMMITED); + avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_UNCOMMITED); } int avahi_entry_is_commited(AvahiEntry *e) { @@ -2260,26 +2260,26 @@ int avahi_entry_is_commited(AvahiEntry *e) { e->group->state == AVAHI_ENTRY_GROUP_ESTABLISHED; } -AvahiEntryGroupState avahi_entry_group_get_state(AvahiEntryGroup *g) { +AvahiEntryGroupState avahi_s_entry_group_get_state(AvahiSEntryGroup *g) { assert(g); assert(!g->dead); return g->state; } -void avahi_entry_group_set_data(AvahiEntryGroup *g, void* userdata) { +void avahi_s_entry_group_set_data(AvahiSEntryGroup *g, void* userdata) { assert(g); g->userdata = userdata; } -void* avahi_entry_group_get_data(AvahiEntryGroup *g) { +void* avahi_s_entry_group_get_data(AvahiSEntryGroup *g) { assert(g); return g->userdata; } -int avahi_entry_group_is_empty(AvahiEntryGroup *g) { +int avahi_s_entry_group_is_empty(AvahiSEntryGroup *g) { AvahiEntry *e; assert(g); diff --git a/avahi-core/server.h b/avahi-core/server.h index 78a403e..3630d1e 100644 --- a/avahi-core/server.h +++ b/avahi-core/server.h @@ -25,6 +25,9 @@ #include #include +/** A locally registered DNS resource record */ +typedef struct AvahiEntry AvahiEntry; + #include "core.h" #include "iface.h" #include "prioq.h" @@ -52,7 +55,7 @@ struct AvahiLegacyUnicastReflectSlot { struct AvahiEntry { AvahiServer *server; - AvahiEntryGroup *group; + AvahiSEntryGroup *group; int dead; @@ -68,13 +71,13 @@ struct AvahiEntry { AVAHI_LLIST_HEAD(AvahiAnnouncement, announcements); }; -struct AvahiEntryGroup { +struct AvahiSEntryGroup { AvahiServer *server; int dead; AvahiEntryGroupState state; void* userdata; - AvahiEntryGroupCallback callback; + AvahiSEntryGroupCallback callback; unsigned n_probing; @@ -82,7 +85,7 @@ struct AvahiEntryGroup { struct timeval register_time; AvahiTimeEvent *register_time_event; - AVAHI_LLIST_FIELDS(AvahiEntryGroup, groups); + AVAHI_LLIST_FIELDS(AvahiSEntryGroup, groups); AVAHI_LLIST_HEAD(AvahiEntry, entries); }; @@ -95,17 +98,17 @@ struct AvahiServer { AVAHI_LLIST_HEAD(AvahiEntry, entries); AvahiHashmap *entries_by_key; - AVAHI_LLIST_HEAD(AvahiEntryGroup, groups); + AVAHI_LLIST_HEAD(AvahiSEntryGroup, groups); - AVAHI_LLIST_HEAD(AvahiRecordBrowser, record_browsers); + AVAHI_LLIST_HEAD(AvahiSRecordBrowser, record_browsers); AvahiHashmap *record_browser_hashmap; - AVAHI_LLIST_HEAD(AvahiHostNameResolver, host_name_resolvers); - AVAHI_LLIST_HEAD(AvahiAddressResolver, address_resolvers); - AVAHI_LLIST_HEAD(AvahiDomainBrowser, domain_browsers); - AVAHI_LLIST_HEAD(AvahiServiceTypeBrowser, service_type_browsers); - AVAHI_LLIST_HEAD(AvahiServiceBrowser, service_browsers); - AVAHI_LLIST_HEAD(AvahiServiceResolver, service_resolvers); - AVAHI_LLIST_HEAD(AvahiDNSServerBrowser, dns_server_browsers); + AVAHI_LLIST_HEAD(AvahiSHostNameResolver, host_name_resolvers); + AVAHI_LLIST_HEAD(AvahiSAddressResolver, address_resolvers); + AVAHI_LLIST_HEAD(AvahiSDomainBrowser, domain_browsers); + AVAHI_LLIST_HEAD(AvahiSServiceTypeBrowser, service_type_browsers); + AVAHI_LLIST_HEAD(AvahiSServiceBrowser, service_browsers); + AVAHI_LLIST_HEAD(AvahiSServiceResolver, service_resolvers); + AVAHI_LLIST_HEAD(AvahiSDNSServerBrowser, dns_server_browsers); int need_entry_cleanup, need_group_cleanup, need_browser_cleanup; @@ -124,8 +127,8 @@ struct AvahiServer { AvahiServerCallback callback; void* userdata; - AvahiEntryGroup *hinfo_entry_group; - AvahiEntryGroup *browse_domain_entry_group; + AvahiSEntryGroup *hinfo_entry_group; + AvahiSEntryGroup *browse_domain_entry_group; unsigned n_host_rr_pending; /* Used for assembling responses */ @@ -146,13 +149,13 @@ void avahi_server_prepare_response(AvahiServer *s, AvahiInterface *i, AvahiEntry void avahi_server_prepare_matching_responses(AvahiServer *s, AvahiInterface *i, AvahiKey *k, int unicast_response); void avahi_server_generate_response(AvahiServer *s, AvahiInterface *i, AvahiDnsPacket *p, const AvahiAddress *a, uint16_t port, int legacy_unicast, int is_probe); -void avahi_entry_group_change_state(AvahiEntryGroup *g, AvahiEntryGroupState state); +void avahi_s_entry_group_change_state(AvahiSEntryGroup *g, AvahiEntryGroupState state); int avahi_entry_is_commited(AvahiEntry *e); void avahi_server_enumerate_aux_records(AvahiServer *s, AvahiInterface *i, AvahiRecord *r, void (*callback)(AvahiServer *s, AvahiRecord *r, int flush_cache, void* userdata), void* userdata); -void avahi_host_rr_entry_group_callback(AvahiServer *s, AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata); +void avahi_host_rr_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void *userdata); void avahi_server_decrease_host_rr_pending(AvahiServer *s); void avahi_server_increase_host_rr_pending(AvahiServer *s); diff --git a/avahi-daemon/dbus-protocol.c b/avahi-daemon/dbus-protocol.c index 117f30f..c30873e 100644 --- a/avahi-daemon/dbus-protocol.c +++ b/avahi-daemon/dbus-protocol.c @@ -61,7 +61,7 @@ typedef struct ServiceResolverInfo ServiceResolverInfo; struct EntryGroupInfo { guint id; Client *client; - AvahiEntryGroup *entry_group; + AvahiSEntryGroup *entry_group; gchar *path; gint n_entries; @@ -71,7 +71,7 @@ struct EntryGroupInfo { struct HostNameResolverInfo { Client *client; - AvahiHostNameResolver *host_name_resolver; + AvahiSHostNameResolver *host_name_resolver; DBusMessage *message; AVAHI_LLIST_FIELDS(HostNameResolverInfo, host_name_resolvers); @@ -79,7 +79,7 @@ struct HostNameResolverInfo { struct AddressResolverInfo { Client *client; - AvahiAddressResolver *address_resolver; + AvahiSAddressResolver *address_resolver; DBusMessage *message; AVAHI_LLIST_FIELDS(AddressResolverInfo, address_resolvers); @@ -88,7 +88,7 @@ struct AddressResolverInfo { struct DomainBrowserInfo { guint id; Client *client; - AvahiDomainBrowser *domain_browser; + AvahiSDomainBrowser *domain_browser; gchar *path; AVAHI_LLIST_FIELDS(DomainBrowserInfo, domain_browsers); @@ -97,7 +97,7 @@ struct DomainBrowserInfo { struct ServiceTypeBrowserInfo { guint id; Client *client; - AvahiServiceTypeBrowser *service_type_browser; + AvahiSServiceTypeBrowser *service_type_browser; gchar *path; AVAHI_LLIST_FIELDS(ServiceTypeBrowserInfo, service_type_browsers); @@ -106,7 +106,7 @@ struct ServiceTypeBrowserInfo { struct ServiceBrowserInfo { guint id; Client *client; - AvahiServiceBrowser *service_browser; + AvahiSServiceBrowser *service_browser; gchar *path; AVAHI_LLIST_FIELDS(ServiceBrowserInfo, service_browsers); @@ -114,7 +114,7 @@ struct ServiceBrowserInfo { struct ServiceResolverInfo { Client *client; - AvahiServiceResolver *service_resolver; + AvahiSServiceResolver *service_resolver; DBusMessage *message; AVAHI_LLIST_FIELDS(ServiceResolverInfo, service_resolvers); @@ -149,7 +149,7 @@ static void entry_group_free(EntryGroupInfo *i) { g_assert(i); if (i->entry_group) - avahi_entry_group_free(i->entry_group); + avahi_s_entry_group_free(i->entry_group); dbus_connection_unregister_object_path(server->bus, i->path); g_free(i->path); AVAHI_LLIST_REMOVE(EntryGroupInfo, entry_groups, i->client->entry_groups, i); @@ -164,7 +164,7 @@ static void host_name_resolver_free(HostNameResolverInfo *i) { g_assert(i); if (i->host_name_resolver) - avahi_host_name_resolver_free(i->host_name_resolver); + avahi_s_host_name_resolver_free(i->host_name_resolver); dbus_message_unref(i->message); AVAHI_LLIST_REMOVE(HostNameResolverInfo, host_name_resolvers, i->client->host_name_resolvers, i); @@ -178,7 +178,7 @@ static void address_resolver_free(AddressResolverInfo *i) { g_assert(i); if (i->address_resolver) - avahi_address_resolver_free(i->address_resolver); + avahi_s_address_resolver_free(i->address_resolver); dbus_message_unref(i->message); AVAHI_LLIST_REMOVE(AddressResolverInfo, address_resolvers, i->client->address_resolvers, i); @@ -192,7 +192,7 @@ static void domain_browser_free(DomainBrowserInfo *i) { g_assert(i); if (i->domain_browser) - avahi_domain_browser_free(i->domain_browser); + avahi_s_domain_browser_free(i->domain_browser); dbus_connection_unregister_object_path(server->bus, i->path); g_free(i->path); AVAHI_LLIST_REMOVE(DomainBrowserInfo, domain_browsers, i->client->domain_browsers, i); @@ -207,7 +207,7 @@ static void service_type_browser_free(ServiceTypeBrowserInfo *i) { g_assert(i); if (i->service_type_browser) - avahi_service_type_browser_free(i->service_type_browser); + avahi_s_service_type_browser_free(i->service_type_browser); dbus_connection_unregister_object_path(server->bus, i->path); g_free(i->path); AVAHI_LLIST_REMOVE(ServiceTypeBrowserInfo, service_type_browsers, i->client->service_type_browsers, i); @@ -222,7 +222,7 @@ static void service_browser_free(ServiceBrowserInfo *i) { g_assert(i); if (i->service_browser) - avahi_service_browser_free(i->service_browser); + avahi_s_service_browser_free(i->service_browser); dbus_connection_unregister_object_path(server->bus, i->path); g_free(i->path); AVAHI_LLIST_REMOVE(ServiceBrowserInfo, service_browsers, i->client->service_browsers, i); @@ -237,7 +237,7 @@ static void service_resolver_free(ServiceResolverInfo *i) { g_assert(i); if (i->service_resolver) - avahi_service_resolver_free(i->service_resolver); + avahi_s_service_resolver_free(i->service_resolver); dbus_message_unref(i->message); AVAHI_LLIST_REMOVE(ServiceResolverInfo, service_resolvers, i->client->service_resolvers, i); @@ -500,7 +500,7 @@ fail: return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } -static void entry_group_callback(AvahiServer *s, AvahiEntryGroup *g, AvahiEntryGroupState state, gpointer userdata) { +static void entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, gpointer userdata) { EntryGroupInfo *i = userdata; DBusMessage *m; gint32 t; @@ -557,7 +557,7 @@ static DBusHandlerResult msg_entry_group_impl(DBusConnection *c, DBusMessage *m, goto fail; } - avahi_entry_group_commit(i->entry_group); + avahi_s_entry_group_commit(i->entry_group); return respond_ok(c, m); @@ -568,7 +568,7 @@ static DBusHandlerResult msg_entry_group_impl(DBusConnection *c, DBusMessage *m, goto fail; } - avahi_entry_group_reset(i->entry_group); + avahi_s_entry_group_reset(i->entry_group); return respond_ok(c, m); } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "IsEmpty")) { @@ -580,7 +580,7 @@ static DBusHandlerResult msg_entry_group_impl(DBusConnection *c, DBusMessage *m, goto fail; } - b = !!avahi_entry_group_is_empty(i->entry_group); + b = !!avahi_s_entry_group_is_empty(i->entry_group); reply = dbus_message_new_method_return(m); dbus_message_append_args(reply, DBUS_TYPE_BOOLEAN, &b, DBUS_TYPE_INVALID); @@ -597,7 +597,7 @@ static DBusHandlerResult msg_entry_group_impl(DBusConnection *c, DBusMessage *m, goto fail; } - state = avahi_entry_group_get_state(i->entry_group); + state = avahi_s_entry_group_get_state(i->entry_group); return respond_int32(c, m, (gint32) state); } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddService")) { @@ -722,7 +722,7 @@ fail: return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } -static void host_name_resolver_callback(AvahiHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const gchar *host_name, const AvahiAddress *a, gpointer userdata) { +static void host_name_resolver_callback(AvahiSHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const gchar *host_name, const AvahiAddress *a, gpointer userdata) { HostNameResolverInfo *i = userdata; g_assert(r); @@ -762,7 +762,7 @@ static void host_name_resolver_callback(AvahiHostNameResolver *r, AvahiIfIndex i host_name_resolver_free(i); } -static void address_resolver_callback(AvahiAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const AvahiAddress *address, const gchar *host_name, gpointer userdata) { +static void address_resolver_callback(AvahiSAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const AvahiAddress *address, const gchar *host_name, gpointer userdata) { AddressResolverInfo *i = userdata; g_assert(r); @@ -845,7 +845,7 @@ fail: return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } -static void domain_browser_callback(AvahiDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar *domain, gpointer userdata) { +static void domain_browser_callback(AvahiSDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar *domain, gpointer userdata) { DomainBrowserInfo *i = userdata; DBusMessage *m; gint32 i_interface, i_protocol; @@ -913,7 +913,7 @@ fail: return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } -static void service_type_browser_callback(AvahiServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar *type, const gchar *domain, gpointer userdata) { +static void service_type_browser_callback(AvahiSServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar *type, const gchar *domain, gpointer userdata) { ServiceTypeBrowserInfo *i = userdata; DBusMessage *m; gint32 i_interface, i_protocol; @@ -983,7 +983,7 @@ fail: return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } -static void service_browser_callback(AvahiServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar *name, const gchar *type, const gchar *domain, gpointer userdata) { +static void service_browser_callback(AvahiSServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar *name, const gchar *type, const gchar *domain, gpointer userdata) { ServiceBrowserInfo *i = userdata; DBusMessage *m; gint32 i_interface, i_protocol; @@ -1012,7 +1012,7 @@ static void service_browser_callback(AvahiServiceBrowser *b, AvahiIfIndex interf } static void service_resolver_callback( - AvahiServiceResolver *r, + AvahiSServiceResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, @@ -1278,7 +1278,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, void AVAHI_LLIST_PREPEND(EntryGroupInfo, entry_groups, client->entry_groups, i); client->n_objects++; - if (!(i->entry_group = avahi_entry_group_new(avahi_server, entry_group_callback, i))) { + if (!(i->entry_group = avahi_s_entry_group_new(avahi_server, entry_group_callback, i))) { entry_group_free(i); return respond_error(c, m, avahi_server_errno(avahi_server), NULL); } @@ -1319,7 +1319,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, void AVAHI_LLIST_PREPEND(HostNameResolverInfo, host_name_resolvers, client->host_name_resolvers, i); client->n_objects++; - if (!(i->host_name_resolver = avahi_host_name_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, name, (AvahiProtocol) aprotocol, host_name_resolver_callback, i))) { + if (!(i->host_name_resolver = avahi_s_host_name_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, name, (AvahiProtocol) aprotocol, host_name_resolver_callback, i))) { host_name_resolver_free(i); return respond_error(c, m, avahi_server_errno(avahi_server), NULL); } @@ -1362,7 +1362,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, void AVAHI_LLIST_PREPEND(AddressResolverInfo, address_resolvers, client->address_resolvers, i); client->n_objects++; - if (!(i->address_resolver = avahi_address_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, &a, address_resolver_callback, i))) { + if (!(i->address_resolver = avahi_s_address_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, &a, address_resolver_callback, i))) { address_resolver_free(i); return respond_error(c, m, avahi_server_errno(avahi_server), NULL); } @@ -1415,7 +1415,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, void AVAHI_LLIST_PREPEND(DomainBrowserInfo, domain_browsers, client->domain_browsers, i); client->n_objects++; - if (!(i->domain_browser = avahi_domain_browser_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, domain, (AvahiDomainBrowserType) type, domain_browser_callback, i))) { + if (!(i->domain_browser = avahi_s_domain_browser_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, domain, (AvahiDomainBrowserType) type, domain_browser_callback, i))) { domain_browser_free(i); return respond_error(c, m, avahi_server_errno(avahi_server), NULL); } @@ -1468,7 +1468,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, void AVAHI_LLIST_PREPEND(ServiceTypeBrowserInfo, service_type_browsers, client->service_type_browsers, i); client->n_objects++; - if (!(i->service_type_browser = avahi_service_type_browser_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, domain, service_type_browser_callback, i))) { + if (!(i->service_type_browser = avahi_s_service_type_browser_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, domain, service_type_browser_callback, i))) { service_type_browser_free(i); return respond_error(c, m, avahi_server_errno(avahi_server), NULL); } @@ -1522,7 +1522,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, void AVAHI_LLIST_PREPEND(ServiceBrowserInfo, service_browsers, client->service_browsers, i); client->n_objects++; - if (!(i->service_browser = avahi_service_browser_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, type, domain, service_browser_callback, i))) { + if (!(i->service_browser = avahi_s_service_browser_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, type, domain, service_browser_callback, i))) { service_browser_free(i); return respond_error(c, m, avahi_server_errno(avahi_server), NULL); } @@ -1568,7 +1568,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, void AVAHI_LLIST_PREPEND(ServiceResolverInfo, service_resolvers, client->service_resolvers, i); client->n_objects++; - if (!(i->service_resolver = avahi_service_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, name, type, domain, (AvahiProtocol) aprotocol, service_resolver_callback, i))) { + if (!(i->service_resolver = avahi_s_service_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, name, type, domain, (AvahiProtocol) aprotocol, service_resolver_callback, i))) { service_resolver_free(i); return respond_error(c, m, avahi_server_errno(avahi_server), NULL); } diff --git a/avahi-daemon/main.c b/avahi-daemon/main.c index 94f89b3..a29ad9f 100644 --- a/avahi-daemon/main.c +++ b/avahi-daemon/main.c @@ -76,8 +76,8 @@ typedef struct { #define RESOLV_CONF "/etc/resolv.conf" -static AvahiEntryGroup *dns_servers_entry_group = NULL; -static AvahiEntryGroup *resolv_conf_entry_group = NULL; +static AvahiSEntryGroup *dns_servers_entry_group = NULL; +static AvahiSEntryGroup *resolv_conf_entry_group = NULL; static gchar **resolv_conf = NULL; @@ -136,16 +136,16 @@ finish: return ret; } -static AvahiEntryGroup* add_dns_servers(AvahiServer *s, AvahiEntryGroup* g, gchar **l) { +static AvahiSEntryGroup* add_dns_servers(AvahiServer *s, AvahiSEntryGroup* g, gchar **l) { gchar **p; g_assert(s); g_assert(l); if (!g) - g = avahi_entry_group_new(s, NULL, NULL); + g = avahi_s_entry_group_new(s, NULL, NULL); - g_assert(avahi_entry_group_is_empty(g)); + g_assert(avahi_s_entry_group_is_empty(g)); for (p = l; *p; p++) { AvahiAddress a; @@ -154,13 +154,13 @@ static AvahiEntryGroup* add_dns_servers(AvahiServer *s, AvahiEntryGroup* g, gcha avahi_log_warn("Failed to parse address '%s', ignoring.", *p); else if (avahi_server_add_dns_server_address(s, g, -1, AF_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, &a, 53) < 0) { - avahi_entry_group_free(g); + avahi_s_entry_group_free(g); avahi_log_error("Failed to add DNS server address: %s", avahi_strerror(avahi_server_errno(s))); return NULL; } } - avahi_entry_group_commit(g); + avahi_s_entry_group_commit(g); return g; } @@ -168,10 +168,10 @@ static AvahiEntryGroup* add_dns_servers(AvahiServer *s, AvahiEntryGroup* g, gcha static void remove_dns_server_entry_groups(void) { if (resolv_conf_entry_group) - avahi_entry_group_reset(resolv_conf_entry_group); + avahi_s_entry_group_reset(resolv_conf_entry_group); if (dns_servers_entry_group) - avahi_entry_group_reset(dns_servers_entry_group); + avahi_s_entry_group_reset(dns_servers_entry_group); } static void server_callback(AvahiServer *s, AvahiServerState state, void *userdata) { @@ -479,7 +479,7 @@ static gboolean signal_callback(GIOChannel *source, GIOCondition condition, gpoi static_service_add_to_server(); if (resolv_conf_entry_group) - avahi_entry_group_reset(resolv_conf_entry_group); + avahi_s_entry_group_reset(resolv_conf_entry_group); load_resolv_conf(&config); diff --git a/avahi-daemon/simple-protocol.c b/avahi-daemon/simple-protocol.c index 12d8adb..ec43049 100644 --- a/avahi-daemon/simple-protocol.c +++ b/avahi-daemon/simple-protocol.c @@ -65,9 +65,9 @@ struct Client { gchar inbuf[BUFFER_SIZE], outbuf[BUFFER_SIZE]; guint inbuf_length, outbuf_length; - AvahiHostNameResolver *host_name_resolver; - AvahiAddressResolver *address_resolver; - AvahiDNSServerBrowser *dns_server_browser; + AvahiSHostNameResolver *host_name_resolver; + AvahiSAddressResolver *address_resolver; + AvahiSDNSServerBrowser *dns_server_browser; AvahiProtocol afquery; @@ -94,13 +94,13 @@ static void client_free(Client *c) { c->server->n_clients--; if (c->host_name_resolver) - avahi_host_name_resolver_free(c->host_name_resolver); + avahi_s_host_name_resolver_free(c->host_name_resolver); if (c->address_resolver) - avahi_address_resolver_free(c->address_resolver); + avahi_s_address_resolver_free(c->address_resolver); if (c->dns_server_browser) - avahi_dns_server_browser_free(c->dns_server_browser); + avahi_s_dns_server_browser_free(c->dns_server_browser); g_source_remove_poll(&c->server->source, &c->poll_fd); close(c->fd); @@ -165,7 +165,7 @@ static void client_output_printf(Client *c, const gchar *format, ...) { static void host_name_resolver_callback( - AvahiHostNameResolver *r, + AvahiSHostNameResolver *r, AvahiIfIndex iface, AvahiProtocol protocol, AvahiResolverEvent event, @@ -189,7 +189,7 @@ static void host_name_resolver_callback( } static void address_resolver_callback( - AvahiAddressResolver *r, + AvahiSAddressResolver *r, AvahiIfIndex iface, AvahiProtocol protocol, AvahiResolverEvent event, @@ -209,7 +209,16 @@ static void address_resolver_callback( c->state = CLIENT_DEAD; } -static void dns_server_browser_callback(AvahiDNSServerBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *host_name, const AvahiAddress *a, uint16_t port, void* userdata) { +static void dns_server_browser_callback( + AvahiSDNSServerBrowser *b, + AvahiIfIndex interface, + AvahiProtocol protocol, + AvahiBrowserEvent event, + const char *host_name, + const AvahiAddress *a, + uint16_t port, + void* userdata) { + Client *c = userdata; gchar t[64]; @@ -254,15 +263,15 @@ static void handle_line(Client *c, const gchar *s) { c->state = CLIENT_DEAD; } else if (strcmp(cmd, "RESOLVE-HOSTNAME-IPV4") == 0 && n_args == 2) { c->state = CLIENT_RESOLVE_HOSTNAME; - if (!(c->host_name_resolver = avahi_host_name_resolver_new(avahi_server, -1, AF_UNSPEC, arg, c->afquery = AF_INET, host_name_resolver_callback, c))) + if (!(c->host_name_resolver = avahi_s_host_name_resolver_new(avahi_server, -1, AF_UNSPEC, arg, c->afquery = AF_INET, host_name_resolver_callback, c))) goto fail; } else if (strcmp(cmd, "RESOLVE-HOSTNAME-IPV6") == 0 && n_args == 2) { c->state = CLIENT_RESOLVE_HOSTNAME; - if (!(c->host_name_resolver = avahi_host_name_resolver_new(avahi_server, -1, AF_UNSPEC, arg, c->afquery = AF_INET6, host_name_resolver_callback, c))) + if (!(c->host_name_resolver = avahi_s_host_name_resolver_new(avahi_server, -1, AF_UNSPEC, arg, c->afquery = AF_INET6, host_name_resolver_callback, c))) goto fail; } else if (strcmp(cmd, "RESOLVE-HOSTNAME") == 0 && n_args == 2) { c->state = CLIENT_RESOLVE_HOSTNAME; - if (!(c->host_name_resolver = avahi_host_name_resolver_new(avahi_server, -1, AF_UNSPEC, arg, c->afquery = AF_UNSPEC, host_name_resolver_callback, c))) + if (!(c->host_name_resolver = avahi_s_host_name_resolver_new(avahi_server, -1, AF_UNSPEC, arg, c->afquery = AF_UNSPEC, host_name_resolver_callback, c))) goto fail; } else if (strcmp(cmd, "RESOLVE-ADDRESS") == 0 && n_args == 2) { AvahiAddress addr; @@ -272,22 +281,22 @@ static void handle_line(Client *c, const gchar *s) { c->state = CLIENT_DEAD; } else { c->state = CLIENT_RESOLVE_ADDRESS; - if (!(c->address_resolver = avahi_address_resolver_new(avahi_server, -1, AF_UNSPEC, &addr, address_resolver_callback, c))) + if (!(c->address_resolver = avahi_s_address_resolver_new(avahi_server, -1, AF_UNSPEC, &addr, address_resolver_callback, c))) goto fail; } } else if (strcmp(cmd, "BROWSE-DNS-SERVERS-IPV4") == 0 && n_args == 1) { c->state = CLIENT_BROWSE_DNS_SERVERS; - if (!(c->dns_server_browser = avahi_dns_server_browser_new(avahi_server, -1, AF_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, c->afquery = AF_INET, dns_server_browser_callback, c))) + if (!(c->dns_server_browser = avahi_s_dns_server_browser_new(avahi_server, -1, AF_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, c->afquery = AF_INET, dns_server_browser_callback, c))) goto fail; client_output_printf(c, "+ Browsing ...\n"); } else if (strcmp(cmd, "BROWSE-DNS-SERVERS-IPV6") == 0 && n_args == 1) { c->state = CLIENT_BROWSE_DNS_SERVERS; - if (!(c->dns_server_browser = avahi_dns_server_browser_new(avahi_server, -1, AF_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, c->afquery = AF_INET6, dns_server_browser_callback, c))) + if (!(c->dns_server_browser = avahi_s_dns_server_browser_new(avahi_server, -1, AF_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, c->afquery = AF_INET6, dns_server_browser_callback, c))) goto fail; client_output_printf(c, "+ Browsing ...\n"); } else if (strcmp(cmd, "BROWSE-DNS-SERVERS") == 0 && n_args == 1) { c->state = CLIENT_BROWSE_DNS_SERVERS; - if (!(c->dns_server_browser = avahi_dns_server_browser_new(avahi_server, -1, AF_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, c->afquery = AF_UNSPEC, dns_server_browser_callback, c))) + if (!(c->dns_server_browser = avahi_s_dns_server_browser_new(avahi_server, -1, AF_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, c->afquery = AF_UNSPEC, dns_server_browser_callback, c))) goto fail; client_output_printf(c, "+ Browsing ...\n"); } else { @@ -519,8 +528,8 @@ void simple_protocol_restart_queries(void) { for (c = server->clients; c; c = c->clients_next) if (c->state == CLIENT_BROWSE_DNS_SERVERS && c->dns_server_browser) { - avahi_dns_server_browser_free(c->dns_server_browser); - c->dns_server_browser = avahi_dns_server_browser_new(avahi_server, -1, AF_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, c->afquery, dns_server_browser_callback, c); + avahi_s_dns_server_browser_free(c->dns_server_browser); + c->dns_server_browser = avahi_s_dns_server_browser_new(avahi_server, -1, AF_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, c->afquery, dns_server_browser_callback, c); } } diff --git a/avahi-daemon/static-services.c b/avahi-daemon/static-services.c index 659d007..ff2602f 100644 --- a/avahi-daemon/static-services.c +++ b/avahi-daemon/static-services.c @@ -63,7 +63,7 @@ struct StaticServiceGroup { gchar *name, *chosen_name; gboolean replace_wildcards; - AvahiEntryGroup *entry_group; + AvahiSEntryGroup *entry_group; AVAHI_LLIST_HEAD(StaticService, services); AVAHI_LLIST_FIELDS(StaticServiceGroup, groups); }; @@ -153,7 +153,7 @@ static void static_service_group_free(StaticServiceGroup *g) { g_assert(g); if (g->entry_group) - avahi_entry_group_free(g->entry_group); + avahi_s_entry_group_free(g->entry_group); while (g->services) static_service_free(g->services); @@ -166,7 +166,7 @@ static void static_service_group_free(StaticServiceGroup *g) { g_free(g); } -static void entry_group_callback(AvahiServer *s, AvahiEntryGroup *eg, AvahiEntryGroupState state, gpointer userdata) { +static void entry_group_callback(AvahiServer *s, AvahiSEntryGroup *eg, AvahiEntryGroupState state, gpointer userdata) { StaticServiceGroup *g = userdata; g_assert(s); @@ -202,9 +202,9 @@ static void add_static_service_group_to_server(StaticServiceGroup *g) { g->chosen_name = g_strdup(g->name); if (!g->entry_group) - g->entry_group = avahi_entry_group_new(avahi_server, entry_group_callback, g); + g->entry_group = avahi_s_entry_group_new(avahi_server, entry_group_callback, g); - g_assert(avahi_entry_group_is_empty(g->entry_group)); + g_assert(avahi_s_entry_group_is_empty(g->entry_group)); for (s = g->services; s; s = s->services_next) { @@ -223,14 +223,14 @@ static void add_static_service_group_to_server(StaticServiceGroup *g) { } } - avahi_entry_group_commit(g->entry_group); + avahi_s_entry_group_commit(g->entry_group); } static void remove_static_service_group_from_server(StaticServiceGroup *g) { g_assert(g); if (g->entry_group) - avahi_entry_group_reset(g->entry_group); + avahi_s_entry_group_reset(g->entry_group); } typedef enum { diff --git a/avahi-discover-standalone/main.c b/avahi-discover-standalone/main.c index 926f4c4..156b76d 100644 --- a/avahi-discover-standalone/main.c +++ b/avahi-discover-standalone/main.c @@ -48,7 +48,7 @@ struct Service { struct ServiceType { gchar *service_type; - AvahiServiceBrowser *browser; + AvahiSServiceBrowser *browser; GList *services; GtkTreeRowReference *tree_ref; @@ -59,9 +59,9 @@ static GtkTreeView *tree_view = NULL; static GtkTreeStore *tree_store = NULL; static GtkLabel *info_label = NULL; static AvahiServer *server = NULL; -static AvahiServiceTypeBrowser *service_type_browser = NULL; +static AvahiSServiceTypeBrowser *service_type_browser = NULL; static GHashTable *service_type_hash_table = NULL; -static AvahiServiceResolver *service_resolver = NULL; +static AvahiSServiceResolver *service_resolver = NULL; static struct Service *current_service = NULL; static struct Service *get_service(const gchar *service_type, const gchar *service_name, const gchar*domain_name, AvahiIfIndex interface, AvahiProtocol protocol) { @@ -92,7 +92,7 @@ static void free_service(struct Service *s) { current_service = NULL; if (service_resolver) { - avahi_service_resolver_free(service_resolver); + avahi_s_service_resolver_free(service_resolver); service_resolver = NULL; } @@ -114,7 +114,7 @@ static void free_service(struct Service *s) { g_free(s); } -static void service_browser_callback(AvahiServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar *service_name, const gchar *service_type, const gchar *domain_name, gpointer userdata) { +static void service_browser_callback(AvahiSServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar *service_name, const gchar *service_type, const gchar *domain_name, gpointer userdata) { if (event == AVAHI_BROWSER_NEW) { struct Service *s; @@ -156,7 +156,7 @@ static void service_browser_callback(AvahiServiceBrowser *b, AvahiIfIndex interf } } -static void service_type_browser_callback(AvahiServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar *service_type, const gchar *domain, gpointer userdata) { +static void service_type_browser_callback(AvahiSServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const gchar *service_type, const gchar *domain, gpointer userdata) { struct ServiceType *st; GtkTreePath *path; GtkTreeIter iter; @@ -180,7 +180,7 @@ static void service_type_browser_callback(AvahiServiceTypeBrowser *b, AvahiIfInd g_hash_table_insert(service_type_hash_table, st->service_type, st); - st->browser = avahi_service_browser_new(server, -1, AF_UNSPEC, st->service_type, domain, service_browser_callback, NULL); + st->browser = avahi_s_service_browser_new(server, -1, AF_UNSPEC, st->service_type, domain, service_browser_callback, NULL); } static void update_label(struct Service *s, const gchar *hostname, const AvahiAddress *a, guint16 port, AvahiStringList *txt) { @@ -230,13 +230,13 @@ static struct Service *get_service_on_cursor(void) { } -static void service_resolver_callback(AvahiServiceResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const gchar *name, const gchar *type, const gchar *domain, const gchar *host_name, const AvahiAddress *a, guint16 port, AvahiStringList *txt, gpointer userdata) { +static void service_resolver_callback(AvahiSServiceResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const gchar *name, const gchar *type, const gchar *domain, const gchar *host_name, const AvahiAddress *a, guint16 port, AvahiStringList *txt, gpointer userdata) { struct Service *s; g_assert(r); if (!(s = get_service_on_cursor()) || userdata != s) { g_assert(r == service_resolver); - avahi_service_resolver_free(service_resolver); + avahi_s_service_resolver_free(service_resolver); service_resolver = NULL; } @@ -253,11 +253,11 @@ static void tree_view_on_cursor_changed(GtkTreeView *tv, gpointer userdata) { return; if (service_resolver) - avahi_service_resolver_free(service_resolver); + avahi_s_service_resolver_free(service_resolver); update_label(s, NULL, NULL, 0, NULL); - service_resolver = avahi_service_resolver_new(server, s->interface, s->protocol, s->service_name, s->service_type->service_type, s->domain_name, AF_UNSPEC, service_resolver_callback, s); + service_resolver = avahi_s_service_resolver_new(server, s->interface, s->protocol, s->service_name, s->service_type->service_type, s->domain_name, AF_UNSPEC, service_resolver_callback, s); } static gboolean main_window_on_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) { @@ -306,7 +306,7 @@ int main(int argc, char *argv[]) { g_assert(server); - service_type_browser = avahi_service_type_browser_new(server, -1, AF_UNSPEC, argc >= 2 ? argv[1] : NULL, service_type_browser_callback, NULL); + service_type_browser = avahi_s_service_type_browser_new(server, -1, AF_UNSPEC, argc >= 2 ? argv[1] : NULL, service_type_browser_callback, NULL); gtk_main(); diff --git a/examples/browse-services.c b/examples/browse-services.c index 472b053..7227bd7 100644 --- a/examples/browse-services.c +++ b/examples/browse-services.c @@ -35,7 +35,7 @@ static AvahiSimplePoll *simple_poll = NULL; static void resolve_callback( - AvahiServiceResolver *r, + AvahiSServiceResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, @@ -67,11 +67,11 @@ static void resolve_callback( avahi_free(t); } - avahi_service_resolver_free(r); + avahi_s_service_resolver_free(r); } static void browse_callback( - AvahiServiceBrowser *b, + AvahiSServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, @@ -98,14 +98,14 @@ static void browse_callback( we free it. If the server is terminated before the callback function is called the server will free the resolver for us. */ - if (!(avahi_service_resolver_new(s, interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, resolve_callback, s))) + if (!(avahi_s_service_resolver_new(s, interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, resolve_callback, s))) fprintf(stderr, "Failed to resolve service '%s': %s\n", name, avahi_strerror(avahi_server_errno(s))); } int main(int argc, char*argv[]) { AvahiServerConfig config; AvahiServer *server = NULL; - AvahiServiceBrowser *sb; + AvahiSServiceBrowser *sb; int error; int ret = 1; @@ -138,7 +138,7 @@ int main(int argc, char*argv[]) { } /* Create the service browser */ - if (!(sb = avahi_service_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_http._tcp", NULL, browse_callback, server))) { + if (!(sb = avahi_s_service_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_http._tcp", NULL, browse_callback, server))) { fprintf(stderr, "Failed to create service browser: %s\n", avahi_strerror(avahi_server_errno(server))); goto fail; } @@ -154,7 +154,7 @@ fail: /* Cleanup things */ if (sb) - avahi_service_browser_free(sb); + avahi_s_service_browser_free(sb); if (server) avahi_server_free(server); diff --git a/examples/publish-service.c b/examples/publish-service.c index 4a78402..6132622 100644 --- a/examples/publish-service.c +++ b/examples/publish-service.c @@ -32,13 +32,13 @@ #include #include -static AvahiEntryGroup *group = NULL; +static AvahiSEntryGroup *group = NULL; static AvahiSimplePoll *simple_poll = NULL; static char *name = NULL; static void create_services(AvahiServer *s); -static void entry_group_callback(AvahiServer *s, AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) { +static void entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void *userdata) { assert(s); assert(g == group); @@ -70,7 +70,7 @@ static void create_services(AvahiServer *s) { /* If this is the first time we're called, let's create a new entry group */ if (!group) { - if (!(group = avahi_entry_group_new(s, entry_group_callback, NULL))) { + if (!(group = avahi_s_entry_group_new(s, entry_group_callback, NULL))) { fprintf(stderr, "avahi_entry_group_new() failed: %s\n", avahi_strerror(avahi_server_errno(s))); goto fail; } @@ -94,7 +94,7 @@ static void create_services(AvahiServer *s) { } /* Tell the server to register the service */ - if ((ret = avahi_entry_group_commit(group)) < 0) { + if ((ret = avahi_s_entry_group_commit(group)) < 0) { fprintf(stderr, "Failed to commit entry_group: %s\n", avahi_strerror(ret)); goto fail; } @@ -137,7 +137,7 @@ static void server_callback(AvahiServer *s, AvahiServerState state, void * userd * in AVAHI_SERVER_RUNNING state we will register them * again with the new host name. */ if (group) - avahi_entry_group_reset(group); + avahi_s_entry_group_reset(group); } } @@ -186,7 +186,7 @@ fail: /* Cleanup things */ if (group) - avahi_entry_group_free(group); + avahi_s_entry_group_free(group); if (server) avahi_server_free(server); -- 2.39.5