]> git.meshlink.io Git - catta/blob - server.h
ba1af789f2b7b5dbc46446d96dff36372d7634cc
[catta] / server.h
1 #ifndef fooAvahiserverhfoo
2 #define fooAvahiserverhfoo
3
4 #include "Avahi.h"
5 #include "iface.h"
6 #include "prioq.h"
7 #include "llist.h"
8 #include "timeeventq.h"
9 #include "announce.h"
10 #include "subscribe.h"
11
12 struct _AvahiEntry {
13     AvahiServer *server;
14     AvahiEntryGroup *group;
15
16     gboolean dead;
17     
18     AvahiEntryFlags flags;
19     AvahiRecord *record;
20     gint interface;
21     guchar protocol;
22
23     AVAHI_LLIST_FIELDS(AvahiEntry, entries);
24     AVAHI_LLIST_FIELDS(AvahiEntry, by_key);
25     AVAHI_LLIST_FIELDS(AvahiEntry, by_group);
26     
27     AVAHI_LLIST_HEAD(AvahiAnnouncement, announcements);
28 };
29
30 struct _AvahiEntryGroup {
31     AvahiServer *server;
32     gboolean dead;
33
34     AvahiEntryGroupState state;
35     gpointer userdata;
36     AvahiEntryGroupCallback callback;
37
38     guint n_probing;
39     
40     AVAHI_LLIST_FIELDS(AvahiEntryGroup, groups);
41     AVAHI_LLIST_HEAD(AvahiEntry, entries);
42 };
43
44 struct _AvahiServer {
45     GMainContext *context;
46     AvahiInterfaceMonitor *monitor;
47
48     AVAHI_LLIST_HEAD(AvahiEntry, entries);
49     GHashTable *entries_by_key;
50
51     AVAHI_LLIST_HEAD(AvahiEntryGroup, groups);
52     
53     AVAHI_LLIST_HEAD(AvahiSubscription, subscriptions);
54     GHashTable *subscription_hashtable;
55
56     gboolean need_entry_cleanup, need_group_cleanup;
57     
58     AvahiTimeEventQueue *time_event_queue;
59     
60     gchar *hostname;
61
62     gint fd_ipv4, fd_ipv6;
63
64     GPollFD pollfd_ipv4, pollfd_ipv6;
65     GSource *source;
66
67     gboolean ignore_bad_ttl;
68 };
69
70 gboolean avahi_server_entry_match_interface(AvahiEntry *e, AvahiInterface *i);
71
72 void avahi_server_post_query(AvahiServer *s, gint interface, guchar protocol, AvahiKey *key);
73 void avahi_server_post_response(AvahiServer *s, gint interface, guchar protocol, AvahiRecord *record, gboolean flush_cache);
74
75 void avahi_entry_group_change_state(AvahiEntryGroup *g, AvahiEntryGroupState state);
76
77 gboolean avahi_entry_commited(AvahiEntry *e);
78
79 #endif