1 #include <sys/socket.h>
4 #include <sys/utsname.h>
11 #include "subscribe.h"
13 static void free_entry(AvahiServer*s, AvahiEntry *e) {
19 avahi_goodbye_entry(s, e, TRUE);
21 /* Remove from linked list */
22 AVAHI_LLIST_REMOVE(AvahiEntry, entries, s->entries, e);
24 /* Remove from hash table indexed by name */
25 t = g_hash_table_lookup(s->entries_by_key, e->record->key);
26 AVAHI_LLIST_REMOVE(AvahiEntry, by_key, t, e);
28 g_hash_table_replace(s->entries_by_key, t->record->key, t);
30 g_hash_table_remove(s->entries_by_key, e->record->key);
32 /* Remove from associated group */
34 AVAHI_LLIST_REMOVE(AvahiEntry, by_group, e->group->entries, e);
36 avahi_record_unref(e->record);
40 static void free_group(AvahiServer *s, AvahiEntryGroup *g) {
45 free_entry(s, g->entries);
47 AVAHI_LLIST_REMOVE(AvahiEntryGroup, groups, s->groups, g);
51 static void cleanup_dead(AvahiServer *s) {
52 AvahiEntryGroup *g, *ng;
57 if (s->need_group_cleanup) {
58 for (g = s->groups; g; g = ng) {
65 s->need_group_cleanup = FALSE;
68 if (s->need_entry_cleanup) {
69 for (e = s->entries; e; e = ne) {
76 s->need_entry_cleanup = FALSE;
80 static void handle_query_key(AvahiServer *s, AvahiKey *k, AvahiInterface *i, const AvahiAddress *a, guint16 port, gboolean legacy_unicast, gboolean unicast_response) {
89 g_message("Handling query: %s", txt = avahi_key_to_string(k));
92 avahi_packet_scheduler_incoming_query(i->scheduler, k);
94 if (k->type == AVAHI_DNS_TYPE_ANY) {
96 /* Handle ANY query */
98 for (e = s->entries; e; e = e->entries_next)
99 if (!e->dead && avahi_key_pattern_match(k, e->record->key) && avahi_entry_registered(s, e, i))
100 avahi_interface_post_response(i, a, e->record, e->flags & AVAHI_ENTRY_UNIQUE, FALSE);
103 /* Handle all other queries */
105 for (e = g_hash_table_lookup(s->entries_by_key, k); e; e = e->by_key_next)
106 if (!e->dead && avahi_entry_registered(s, e, i))
107 avahi_interface_post_response(i, a, e->record, e->flags & AVAHI_ENTRY_UNIQUE, FALSE);
111 static void withdraw_entry(AvahiServer *s, AvahiEntry *e) {
119 for (k = e->group->entries; k; k = k->by_group_next) {
120 avahi_goodbye_entry(s, k, FALSE);
124 avahi_entry_group_change_state(e->group, AVAHI_ENTRY_GROUP_COLLISION);
126 avahi_goodbye_entry(s, e, FALSE);
130 s->need_entry_cleanup = TRUE;
133 static void incoming_probe(AvahiServer *s, AvahiRecord *record, AvahiInterface *i) {
141 t = avahi_record_to_string(record);
143 /* g_message("PROBE: [%s]", t); */
145 for (e = g_hash_table_lookup(s->entries_by_key, record->key); e; e = n) {
148 if (e->dead || avahi_record_equal_no_ttl(record, e->record))
151 if (avahi_entry_registering(s, e, i)) {
154 if ((cmp = avahi_record_lexicographical_compare(record, e->record)) > 0) {
155 withdraw_entry(s, e);
156 g_message("Recieved conflicting probe [%s]. Local host lost. Withdrawing.", t);
158 g_message("Recieved conflicting probe [%s]. Local host won.", t);
166 static void handle_query(AvahiServer *s, AvahiDnsPacket *p, AvahiInterface *i, const AvahiAddress *a, guint16 port, gboolean legacy_unicast) {
174 /* Handle the questions */
175 for (n = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_QDCOUNT); n > 0; n --) {
177 gboolean unicast_response = FALSE;
179 if (!(key = avahi_dns_packet_consume_key(p, &unicast_response))) {
180 g_warning("Packet too short (1)");
184 handle_query_key(s, key, i, a, port, legacy_unicast, unicast_response);
185 avahi_key_unref(key);
188 /* Known Answer Suppression */
189 for (n = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT); n > 0; n --) {
191 gboolean unique = FALSE;
193 if (!(record = avahi_dns_packet_consume_record(p, &unique))) {
194 g_warning("Packet too short (2)");
198 avahi_packet_scheduler_incoming_known_answer(i->scheduler, record, a);
199 avahi_record_unref(record);
203 for (n = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_NSCOUNT); n > 0; n --) {
205 gboolean unique = FALSE;
207 if (!(record = avahi_dns_packet_consume_record(p, &unique))) {
208 g_warning("Packet too short (3)");
212 if (record->key->type != AVAHI_DNS_TYPE_ANY)
213 incoming_probe(s, record, i);
215 avahi_record_unref(record);
219 static gboolean handle_conflict(AvahiServer *s, AvahiInterface *i, AvahiRecord *record, gboolean unique, const AvahiAddress *a) {
220 gboolean valid = TRUE;
228 t = avahi_record_to_string(record);
230 /* g_message("CHECKING FOR CONFLICT: [%s]", t); */
232 for (e = g_hash_table_lookup(s->entries_by_key, record->key); e; e = n) {
238 if (avahi_entry_registered(s, e, i)) {
240 gboolean equal = avahi_record_equal_no_ttl(record, e->record);
242 /* Check whether there is a unique record conflict */
243 if (!equal && ((e->flags & AVAHI_ENTRY_UNIQUE) || unique)) {
246 /* The lexicographically later data wins. */
247 if ((cmp = avahi_record_lexicographical_compare(record, e->record)) > 0) {
248 g_message("Recieved conflicting record [%s]. Local host lost. Withdrawing.", t);
249 withdraw_entry(s, e);
250 } else if (cmp < 0) {
251 /* Tell the other host that our entry is lexicographically later */
253 g_message("Recieved conflicting record [%s]. Local host won. Refreshing.", t);
256 avahi_interface_post_response(i, a, e->record, e->flags & AVAHI_ENTRY_UNIQUE, TRUE);
259 /* Check wheter there is a TTL conflict */
260 } else if (equal && record->ttl <= e->record->ttl/2) {
261 /* Correct the TTL */
263 avahi_interface_post_response(i, a, e->record, e->flags & AVAHI_ENTRY_UNIQUE, TRUE);
264 g_message("Recieved record with bad TTL [%s]. Refreshing.", t);
267 } else if (avahi_entry_registering(s, e, i)) {
269 if (!avahi_record_equal_no_ttl(record, e->record) && ((e->flags & AVAHI_ENTRY_UNIQUE) || unique)) {
271 /* We are currently registering a matching record, but
272 * someone else already claimed it, so let's
275 g_message("Recieved conflicting record [%s] with local record to be. Withdrawing.", t);
276 withdraw_entry(s, e);
286 static void handle_response(AvahiServer *s, AvahiDnsPacket *p, AvahiInterface *i, const AvahiAddress *a) {
294 for (n = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) +
295 avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ARCOUNT); n > 0; n--) {
297 gboolean cache_flush = FALSE;
300 if (!(record = avahi_dns_packet_consume_record(p, &cache_flush))) {
301 g_warning("Packet too short (4)");
305 if (record->key->type != AVAHI_DNS_TYPE_ANY) {
307 g_message("Handling response: %s", txt = avahi_record_to_string(record));
310 if (handle_conflict(s, i, record, cache_flush, a)) {
311 avahi_cache_update(i->cache, record, cache_flush, a);
312 avahi_packet_scheduler_incoming_response(i->scheduler, record);
316 avahi_record_unref(record);
320 static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, struct sockaddr *sa, gint iface, gint ttl) {
330 if (!(i = avahi_interface_monitor_get_interface(s->monitor, iface, sa->sa_family))) {
331 g_warning("Recieved packet from invalid interface.");
335 g_message("new packet recieved on interface '%s.%i'.", i->hardware->name, i->protocol);
337 if (sa->sa_family == AF_INET6) {
338 static const guint8 ipv4_in_ipv6[] = {
339 0x00, 0x00, 0x00, 0x00,
340 0x00, 0x00, 0x00, 0x00,
341 0xFF, 0xFF, 0xFF, 0xFF };
343 /* This is an IPv4 address encapsulated in IPv6, so let's ignore it. */
345 if (memcmp(((struct sockaddr_in6*) sa)->sin6_addr.s6_addr, ipv4_in_ipv6, sizeof(ipv4_in_ipv6)) == 0)
349 if (avahi_dns_packet_check_valid(p) < 0) {
350 g_warning("Recieved invalid packet.");
354 port = avahi_port_from_sockaddr(sa);
355 avahi_address_from_sockaddr(sa, &a);
357 if (avahi_dns_packet_is_query(p)) {
358 gboolean legacy_unicast = FALSE;
360 if (avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_QDCOUNT) == 0 ||
361 avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ARCOUNT) != 0) {
362 g_warning("Invalid query packet.");
366 if (port != AVAHI_MDNS_PORT) {
369 if ((avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) != 0 ||
370 avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_NSCOUNT) != 0)) {
371 g_warning("Invalid legacy unicast query packet.");
375 legacy_unicast = TRUE;
378 handle_query(s, p, i, &a, port, legacy_unicast);
380 g_message("Handled query");
383 if (port != AVAHI_MDNS_PORT) {
384 g_warning("Recieved repsonse with invalid source port %u on interface '%s.%i'", port, i->hardware->name, i->protocol);
389 g_warning("Recieved response with invalid TTL %u on interface '%s.%i'.", ttl, i->hardware->name, i->protocol);
390 if (!s->ignore_bad_ttl)
394 if (avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_QDCOUNT) != 0 ||
395 avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) == 0 ||
396 avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_NSCOUNT) != 0) {
397 g_warning("Invalid response packet.");
401 handle_response(s, p, i, &a);
402 g_message("Handled response");
406 static void work(AvahiServer *s) {
407 struct sockaddr_in6 sa6;
408 struct sockaddr_in sa;
415 if (s->pollfd_ipv4.revents & G_IO_IN) {
416 if ((p = avahi_recv_dns_packet_ipv4(s->fd_ipv4, &sa, &iface, &ttl))) {
417 dispatch_packet(s, p, (struct sockaddr*) &sa, iface, ttl);
418 avahi_dns_packet_free(p);
422 if (s->pollfd_ipv6.revents & G_IO_IN) {
423 if ((p = avahi_recv_dns_packet_ipv6(s->fd_ipv6, &sa6, &iface, &ttl))) {
424 dispatch_packet(s, p, (struct sockaddr*) &sa6, iface, ttl);
425 avahi_dns_packet_free(p);
430 static gboolean prepare_func(GSource *source, gint *timeout) {
438 static gboolean check_func(GSource *source) {
442 s = *((AvahiServer**) (((guint8*) source) + sizeof(GSource)));
445 return (s->pollfd_ipv4.revents | s->pollfd_ipv6.revents) & (G_IO_IN | G_IO_HUP | G_IO_ERR);
448 static gboolean dispatch_func(GSource *source, GSourceFunc callback, gpointer user_data) {
452 s = *((AvahiServer**) (((guint8*) source) + sizeof(GSource)));
461 static void add_default_entries(AvahiServer *s) {
463 struct utsname utsname;
470 /* Fill in HINFO rr */
471 r = avahi_record_new_full(s->hostname, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_HINFO);
473 r->data.hinfo.cpu = g_strdup(g_strup(utsname.machine));
474 r->data.hinfo.os = g_strdup(g_strup(utsname.sysname));
475 avahi_server_add(s, NULL, 0, AF_UNSPEC, AVAHI_ENTRY_UNIQUE, r);
476 avahi_record_unref(r);
478 /* Add localhost entries */
479 avahi_address_parse("127.0.0.1", AF_INET, &a);
480 avahi_server_add_address(s, NULL, 0, AF_UNSPEC, AVAHI_ENTRY_UNIQUE|AVAHI_ENTRY_NOPROBE|AVAHI_ENTRY_NOANNOUNCE, "localhost", &a);
482 avahi_address_parse("::1", AF_INET6, &a);
483 avahi_server_add_address(s, NULL, 0, AF_UNSPEC, AVAHI_ENTRY_UNIQUE|AVAHI_ENTRY_NOPROBE|AVAHI_ENTRY_NOANNOUNCE, "ip6-localhost", &a);
486 AvahiServer *avahi_server_new(GMainContext *c) {
490 static GSourceFuncs source_funcs = {
499 s = g_new(AvahiServer, 1);
501 s->ignore_bad_ttl = FALSE;
502 s->need_entry_cleanup = s->need_group_cleanup = FALSE;
504 s->fd_ipv4 = avahi_open_socket_ipv4();
505 s->fd_ipv6 = avahi_open_socket_ipv6();
507 if (s->fd_ipv6 < 0 && s->fd_ipv4 < 0) {
508 g_critical("Failed to create IP sockets.\n");
514 g_message("Failed to create IPv4 socket, proceeding in IPv6 only mode");
515 else if (s->fd_ipv6 < 0)
516 g_message("Failed to create IPv6 socket, proceeding in IPv4 only mode");
519 g_main_context_ref(s->context = c);
521 s->context = g_main_context_default();
523 AVAHI_LLIST_HEAD_INIT(AvahiEntry, s->entries);
524 s->entries_by_key = g_hash_table_new((GHashFunc) avahi_key_hash, (GEqualFunc) avahi_key_equal);
525 AVAHI_LLIST_HEAD_INIT(AvahiGroup, s->groups);
527 AVAHI_LLIST_HEAD_INIT(AvahiSubscription, s->subscriptions);
528 s->subscription_hashtable = g_hash_table_new((GHashFunc) avahi_key_hash, (GEqualFunc) avahi_key_equal);
531 hn = avahi_get_host_name();
532 hn[strcspn(hn, ".")] = 0;
534 s->hostname = g_strdup_printf("%s.local.", hn);
537 s->time_event_queue = avahi_time_event_queue_new(s->context, G_PRIORITY_DEFAULT+10); /* Slightly less priority than the FDs */
538 s->monitor = avahi_interface_monitor_new(s);
539 avahi_interface_monitor_sync(s->monitor);
540 add_default_entries(s);
542 /* Prepare IO source registration */
543 s->source = g_source_new(&source_funcs, sizeof(GSource) + sizeof(AvahiServer*));
544 *((AvahiServer**) (((guint8*) s->source) + sizeof(GSource))) = s;
546 memset(&s->pollfd_ipv4, 0, sizeof(s->pollfd_ipv4));
547 s->pollfd_ipv4.fd = s->fd_ipv4;
548 s->pollfd_ipv4.events = G_IO_IN|G_IO_ERR|G_IO_HUP;
549 g_source_add_poll(s->source, &s->pollfd_ipv4);
551 memset(&s->pollfd_ipv6, 0, sizeof(s->pollfd_ipv6));
552 s->pollfd_ipv6.fd = s->fd_ipv6;
553 s->pollfd_ipv6.events = G_IO_IN|G_IO_ERR|G_IO_HUP;
554 g_source_add_poll(s->source, &s->pollfd_ipv6);
556 g_source_attach(s->source, s->context);
561 void avahi_server_free(AvahiServer* s) {
565 free_entry(s, s->entries);
567 avahi_interface_monitor_free(s->monitor);
570 free_group(s, s->groups);
572 while (s->subscriptions)
573 avahi_subscription_free(s->subscriptions);
574 g_hash_table_destroy(s->subscription_hashtable);
576 g_hash_table_destroy(s->entries_by_key);
578 avahi_time_event_queue_free(s->time_event_queue);
587 g_source_destroy(s->source);
588 g_source_unref(s->source);
589 g_main_context_unref(s->context);
594 void avahi_server_add(
599 AvahiEntryFlags flags,
606 g_assert(r->key->type != AVAHI_DNS_TYPE_ANY);
608 e = g_new(AvahiEntry, 1);
610 e->record = avahi_record_ref(r);
612 e->interface = interface;
613 e->protocol = protocol;
617 AVAHI_LLIST_HEAD_INIT(AvahiAnnouncement, e->announcements);
619 AVAHI_LLIST_PREPEND(AvahiEntry, entries, s->entries, e);
621 /* Insert into hash table indexed by name */
622 t = g_hash_table_lookup(s->entries_by_key, e->record->key);
623 AVAHI_LLIST_PREPEND(AvahiEntry, by_key, t, e);
624 g_hash_table_replace(s->entries_by_key, e->record->key, t);
626 /* Insert into group list */
628 AVAHI_LLIST_PREPEND(AvahiEntry, by_group, g->entries, e);
630 avahi_announce_entry(s, e);
632 const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiEntryGroup *g, void **state) {
633 AvahiEntry **e = (AvahiEntry**) state;
638 *e = g ? g->entries : s->entries;
640 while (*e && (*e)->dead)
641 *e = g ? (*e)->by_group_next : (*e)->entries_next;
646 return avahi_record_ref((*e)->record);
649 void avahi_server_dump(AvahiServer *s, FILE *f) {
654 fprintf(f, "\n;;; ZONE DUMP FOLLOWS ;;;\n");
656 for (e = s->entries; e; e = e->entries_next) {
662 t = avahi_record_to_string(e->record);
663 fprintf(f, "%s ; iface=%i proto=%i\n", t, e->interface, e->protocol);
667 avahi_dump_caches(s->monitor, f);
670 void avahi_server_add_ptr(
675 AvahiEntryFlags flags,
683 r = avahi_record_new_full(name ? name : s->hostname, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR);
684 r->data.ptr.name = avahi_normalize_name(dest);
685 avahi_server_add(s, g, interface, protocol, flags, r);
686 avahi_record_unref(r);
689 void avahi_server_add_address(
694 AvahiEntryFlags flags,
702 name = name ? (n = avahi_normalize_name(name)) : s->hostname;
704 if (a->family == AF_INET) {
708 r = avahi_record_new_full(name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_A);
709 r->data.a.address = a->data.ipv4;
710 avahi_server_add(s, g, interface, protocol, flags, r);
711 avahi_record_unref(r);
713 reverse = avahi_reverse_lookup_name_ipv4(&a->data.ipv4);
715 avahi_server_add_ptr(s, g, interface, protocol, flags, reverse, name);
722 r = avahi_record_new_full(name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_AAAA);
723 r->data.aaaa.address = a->data.ipv6;
724 avahi_server_add(s, g, interface, protocol, flags, r);
725 avahi_record_unref(r);
727 reverse = avahi_reverse_lookup_name_ipv6_arpa(&a->data.ipv6);
729 avahi_server_add_ptr(s, g, interface, protocol, flags, reverse, name);
732 reverse = avahi_reverse_lookup_name_ipv6_int(&a->data.ipv6);
734 avahi_server_add_ptr(s, g, interface, protocol, flags, reverse, name);
741 void avahi_server_add_text_strlst(
746 AvahiEntryFlags flags,
748 AvahiStringList *strlst) {
754 r = avahi_record_new_full(name ? name : s->hostname, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_TXT);
755 r->data.txt.string_list = strlst;
756 avahi_server_add(s, g, interface, protocol, flags, r);
757 avahi_record_unref(r);
760 void avahi_server_add_text_va(
765 AvahiEntryFlags flags,
771 avahi_server_add_text_strlst(s, g, interface, protocol, flags, name, avahi_string_list_new_va(va));
774 void avahi_server_add_text(
779 AvahiEntryFlags flags,
788 avahi_server_add_text_va(s, g, interface, protocol, flags, name, va);
792 static void escape_service_name(gchar *d, guint size, const gchar *s) {
797 while (*s && size >= 2) {
798 if (*s == '.' || *s == '\\') {
814 void avahi_server_add_service_strlst(
824 AvahiStringList *strlst) {
826 gchar ptr_name[256], svc_name[256], ename[64], enum_ptr[256];
833 escape_service_name(ename, sizeof(ename), name);
836 while (domain[0] == '.')
844 snprintf(ptr_name, sizeof(ptr_name), "%s.%s", type, domain);
845 snprintf(svc_name, sizeof(svc_name), "%s.%s.%s", ename, type, domain);
847 avahi_server_add_ptr(s, g, interface, protocol, AVAHI_ENTRY_NULL, ptr_name, svc_name);
849 r = avahi_record_new_full(svc_name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV);
850 r->data.srv.priority = 0;
851 r->data.srv.weight = 0;
852 r->data.srv.port = port;
853 r->data.srv.name = avahi_normalize_name(host);
854 avahi_server_add(s, g, interface, protocol, AVAHI_ENTRY_UNIQUE, r);
855 avahi_record_unref(r);
857 avahi_server_add_text_strlst(s, g, interface, protocol, AVAHI_ENTRY_UNIQUE, svc_name, strlst);
859 snprintf(enum_ptr, sizeof(enum_ptr), "_services._dns-sd._udp.%s", domain);
860 avahi_server_add_ptr(s, g, interface, protocol, AVAHI_ENTRY_NULL, enum_ptr, ptr_name);
863 void avahi_server_add_service_va(
879 avahi_server_add_service(s, g, interface, protocol, type, name, domain, host, port, avahi_string_list_new_va(va));
882 void avahi_server_add_service(
901 avahi_server_add_service_va(s, g, interface, protocol, type, name, domain, host, port, va);
905 static void post_query_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, gpointer userdata) {
906 AvahiKey *k = userdata;
912 avahi_interface_post_query(i, k, FALSE);
915 void avahi_server_post_query(AvahiServer *s, gint interface, guchar protocol, AvahiKey *key) {
919 avahi_interface_monitor_walk(s->monitor, interface, protocol, post_query_callback, key);
924 gboolean flush_cache;
927 static void post_response_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, gpointer userdata) {
928 struct tmpdata *tmpdata = userdata;
934 avahi_interface_post_response(i, NULL, tmpdata->record, tmpdata->flush_cache, FALSE);
937 void avahi_server_post_response(AvahiServer *s, gint interface, guchar protocol, AvahiRecord *record, gboolean flush_cache) {
938 struct tmpdata tmpdata;
943 tmpdata.record = record;
944 tmpdata.flush_cache = flush_cache;
946 avahi_interface_monitor_walk(s->monitor, interface, protocol, post_response_callback, &tmpdata);
949 void avahi_entry_group_change_state(AvahiEntryGroup *g, AvahiEntryGroupState state) {
955 g->callback(g->server, g, state, g->userdata);
960 AvahiEntryGroup *avahi_entry_group_new(AvahiServer *s, AvahiEntryGroupCallback callback, gpointer userdata) {
965 g = g_new(AvahiEntryGroup, 1);
967 g->callback = callback;
968 g->userdata = userdata;
970 g->state = AVAHI_ENTRY_GROUP_UNCOMMITED;
972 AVAHI_LLIST_HEAD_INIT(AvahiEntry, g->entries);
974 AVAHI_LLIST_PREPEND(AvahiEntryGroup, groups, s->groups, g);
978 void avahi_entry_group_free(AvahiEntryGroup *g) {
983 g->server->need_group_cleanup = TRUE;
986 void avahi_entry_group_commit(AvahiEntryGroup *g) {
992 if (g->state != AVAHI_ENTRY_GROUP_UNCOMMITED)
995 avahi_entry_group_change_state(g, AVAHI_ENTRY_GROUP_REGISTERING);
996 avahi_announce_group(g->server, g);
997 avahi_entry_group_check_probed(g, FALSE);
1000 gboolean avahi_entry_commited(AvahiEntry *e) {
1005 e->group->state == AVAHI_ENTRY_GROUP_REGISTERING ||
1006 e->group->state == AVAHI_ENTRY_GROUP_ESTABLISHED;
1009 AvahiEntryGroupState avahi_entry_group_get_state(AvahiEntryGroup *g) {