]> git.meshlink.io Git - catta/blob - libavahi-core/server.h
update todo
[catta] / libavahi-core / server.h
1 #ifndef fooserverhfoo
2 #define fooserverhfoo
3
4 /* $Id$ */
5
6 /***
7   This file is part of avahi.
8  
9   avahi is free software; you can redistribute it and/or modify it
10   under the terms of the GNU Lesser General Public License as
11   published by the Free Software Foundation; either version 2.1 of the
12   License, or (at your option) any later version.
13  
14   avahi is distributed in the hope that it will be useful, but WITHOUT
15   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16   or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
17   Public License for more details.
18  
19   You should have received a copy of the GNU Lesser General Public
20   License along with avahi; if not, write to the Free Software
21   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22   USA.
23 ***/
24
25 #include "avahi.h"
26 #include "iface.h"
27 #include "prioq.h"
28 #include "llist.h"
29 #include "timeeventq.h"
30 #include "announce.h"
31 #include "subscribe.h"
32
33 struct _AvahiEntry {
34     AvahiServer *server;
35     AvahiEntryGroup *group;
36
37     gboolean dead;
38     
39     AvahiEntryFlags flags;
40     AvahiRecord *record;
41     gint interface;
42     guchar protocol;
43
44     AVAHI_LLIST_FIELDS(AvahiEntry, entries);
45     AVAHI_LLIST_FIELDS(AvahiEntry, by_key);
46     AVAHI_LLIST_FIELDS(AvahiEntry, by_group);
47     
48     AVAHI_LLIST_HEAD(AvahiAnnouncement, announcements);
49 };
50
51 struct _AvahiEntryGroup {
52     AvahiServer *server;
53     gboolean dead;
54
55     AvahiEntryGroupState state;
56     gpointer userdata;
57     AvahiEntryGroupCallback callback;
58
59     guint n_probing;
60     
61     AVAHI_LLIST_FIELDS(AvahiEntryGroup, groups);
62     AVAHI_LLIST_HEAD(AvahiEntry, entries);
63 };
64
65 struct _AvahiServer {
66     GMainContext *context;
67     AvahiInterfaceMonitor *monitor;
68
69     AVAHI_LLIST_HEAD(AvahiEntry, entries);
70     GHashTable *entries_by_key;
71
72     AVAHI_LLIST_HEAD(AvahiEntryGroup, groups);
73     
74     AVAHI_LLIST_HEAD(AvahiSubscription, subscriptions);
75     GHashTable *subscription_hashtable;
76
77     gboolean need_entry_cleanup, need_group_cleanup;
78     
79     AvahiTimeEventQueue *time_event_queue;
80     
81     gchar *hostname;
82
83     gint fd_ipv4, fd_ipv6;
84
85     GPollFD pollfd_ipv4, pollfd_ipv6;
86     GSource *source;
87
88     gboolean ignore_bad_ttl;
89 };
90
91 gboolean avahi_server_entry_match_interface(AvahiEntry *e, AvahiInterface *i);
92
93 void avahi_server_post_query(AvahiServer *s, gint interface, guchar protocol, AvahiKey *key);
94 void avahi_server_post_response(AvahiServer *s, gint interface, guchar protocol, AvahiRecord *record, gboolean flush_cache);
95
96 void avahi_entry_group_change_state(AvahiEntryGroup *g, AvahiEntryGroupState state);
97
98 gboolean avahi_entry_commited(AvahiEntry *e);
99
100 #endif