X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-core%2Fserver.h;h=6572fbb69e9983ade674cf7d3cf4113be455274c;hb=ae5476c763ae89cdef130397439b6746883cb1b5;hp=fb137b03770c6f50c4a3fbd6966daf7b6c1a7f5a;hpb=da69334ace7a4620e67fbf0a3eed61835d272ae3;p=catta diff --git a/avahi-core/server.h b/avahi-core/server.h index fb137b0..6572fbb 100644 --- a/avahi-core/server.h +++ b/avahi-core/server.h @@ -32,6 +32,21 @@ #include "dns.h" #include "rrlist.h" +#define AVAHI_MAX_LEGACY_UNICAST_REFLECT_SLOTS 100 + +typedef struct AvahiLegacyUnicastReflectSlot AvahiLegacyUnicastReflectSlot; + +struct AvahiLegacyUnicastReflectSlot { + AvahiServer *server; + + guint16 id, original_id; + AvahiAddress address; + guint16 port; + gint interface; + GTimeVal elapse_time; + AvahiTimeEvent *time_event; +}; + struct AvahiEntry { AvahiServer *server; AvahiEntryGroup *group; @@ -40,8 +55,8 @@ struct AvahiEntry { AvahiEntryFlags flags; AvahiRecord *record; - gint interface; - guchar protocol; + AvahiIfIndex interface; + AvahiProtocol protocol; AVAHI_LLIST_FIELDS(AvahiEntry, entries); AVAHI_LLIST_FIELDS(AvahiEntry, by_key); @@ -60,6 +75,10 @@ struct AvahiEntryGroup { guint n_probing; + guint n_register_try; + GTimeVal register_time; + AvahiTimeEvent *register_time_event; + AVAHI_LLIST_FIELDS(AvahiEntryGroup, groups); AVAHI_LLIST_HEAD(AvahiEntry, entries); }; @@ -83,6 +102,7 @@ struct AvahiServer { 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); gboolean need_entry_cleanup, need_group_cleanup, need_browser_cleanup; @@ -90,9 +110,11 @@ struct AvahiServer { gchar *host_name, *host_name_fqdn, *domain_name; - gint fd_ipv4, fd_ipv6; + gint fd_ipv4, fd_ipv6, + /* The following two sockets two are used for reflection only */ + fd_legacy_unicast_ipv4, fd_legacy_unicast_ipv6; - GPollFD pollfd_ipv4, pollfd_ipv6; + GPollFD pollfd_ipv4, pollfd_ipv6, pollfd_legacy_unicast_ipv4, pollfd_legacy_unicast_ipv6; GSource *source; AvahiServerState state; @@ -103,19 +125,23 @@ struct AvahiServer { AvahiEntryGroup *browse_domain_entry_group; guint n_host_rr_pending; - AvahiTimeEvent *register_time_event; - /* Used for assembling responses */ AvahiRecordList *record_list; + + /* Used for reflection of legacy unicast packets */ + AvahiLegacyUnicastReflectSlot **legacy_unicast_reflect_slots; + guint16 legacy_unicast_reflect_id; + + gint error; }; gboolean avahi_server_entry_match_interface(AvahiEntry *e, AvahiInterface *i); -void avahi_server_post_query(AvahiServer *s, gint interface, guchar protocol, AvahiKey *key); +void avahi_server_post_query(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, AvahiKey *key); void avahi_server_prepare_response(AvahiServer *s, AvahiInterface *i, AvahiEntry *e, gboolean unicast_response, gboolean auxiliary); void avahi_server_prepare_matching_responses(AvahiServer *s, AvahiInterface *i, AvahiKey *k, gboolean unicast_response); -void avahi_server_generate_response(AvahiServer *s, AvahiInterface *i, AvahiDnsPacket *p, const AvahiAddress *a, guint16 port, gboolean legacy_unicast); +void avahi_server_generate_response(AvahiServer *s, AvahiInterface *i, AvahiDnsPacket *p, const AvahiAddress *a, guint16 port, gboolean legacy_unicast, gboolean is_probe); void avahi_entry_group_change_state(AvahiEntryGroup *g, AvahiEntryGroupState state); @@ -128,4 +154,6 @@ void avahi_host_rr_entry_group_callback(AvahiServer *s, AvahiEntryGroup *g, Avah void avahi_server_decrease_host_rr_pending(AvahiServer *s); void avahi_server_increase_host_rr_pending(AvahiServer *s); +gint avahi_server_set_errno(AvahiServer *s, gint error); + #endif