]> git.meshlink.io Git - catta/blob - libavahi-core/iface.h
update todo
[catta] / libavahi-core / iface.h
1 #ifndef fooifacehfoo
2 #define fooifacehfoo
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 <glib.h>
26
27 typedef struct _AvahiInterfaceMonitor AvahiInterfaceMonitor;
28 typedef struct _AvahiInterfaceAddress AvahiInterfaceAddress;
29 typedef struct _AvahiInterface AvahiInterface;
30 typedef struct _AvahiHwInterface AvahiHwInterface;
31
32 #include "address.h"
33 #include "server.h"
34 #include "netlink.h"
35 #include "cache.h"
36 #include "llist.h"
37 #include "psched.h"
38 #include "dns.h"
39 #include "announce.h"
40
41 struct _AvahiInterfaceMonitor {
42     AvahiServer *server;
43     AvahiNetlink *netlink;
44     GHashTable *hash_table;
45
46     AVAHI_LLIST_HEAD(AvahiInterface, interfaces);
47     AVAHI_LLIST_HEAD(AvahiHwInterface, hw_interfaces);
48     
49     guint query_addr_seq, query_link_seq;
50     
51     enum {
52         LIST_IFACE,
53         LIST_ADDR,
54         LIST_DONE
55     } list;
56 };
57
58 struct _AvahiHwInterface {
59     AVAHI_LLIST_FIELDS(AvahiHwInterface, hardware);
60     AvahiInterfaceMonitor *monitor;
61
62     gchar *name;
63     gint index;
64     guint flags;
65     guint mtu;
66
67     AVAHI_LLIST_HEAD(AvahiInterface, interfaces);
68 };
69
70 struct _AvahiInterface {
71     AVAHI_LLIST_FIELDS(AvahiInterface, interface);
72     AVAHI_LLIST_FIELDS(AvahiInterface, by_hardware);
73     AvahiInterfaceMonitor *monitor;
74     
75     AvahiHwInterface *hardware;
76     guchar protocol;
77     gboolean announcing;
78
79     AvahiCache *cache;
80     AvahiPacketScheduler *scheduler;
81
82     AVAHI_LLIST_HEAD(AvahiInterfaceAddress, addresses);
83     AVAHI_LLIST_HEAD(AvahiAnnouncement, announcements);
84 };
85
86 struct _AvahiInterfaceAddress {
87     AVAHI_LLIST_FIELDS(AvahiInterfaceAddress, address);
88     AvahiInterfaceMonitor *monitor;
89     
90     guchar flags;
91     guchar scope;
92     AvahiAddress address;
93     
94     AvahiEntryGroup *entry_group;
95     AvahiInterface *interface;
96 };
97
98 AvahiInterfaceMonitor *avahi_interface_monitor_new(AvahiServer *server);
99 void avahi_interface_monitor_free(AvahiInterfaceMonitor *m);
100
101 void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m);
102
103 AvahiInterface* avahi_interface_monitor_get_interface(AvahiInterfaceMonitor *m, gint index, guchar protocol);
104 AvahiHwInterface* avahi_interface_monitor_get_hw_interface(AvahiInterfaceMonitor *m, gint index);
105
106 void avahi_interface_send_packet(AvahiInterface *i, AvahiDnsPacket *p);
107
108 void avahi_interface_post_query(AvahiInterface *i, AvahiKey *k, gboolean immediately);
109 void avahi_interface_post_probe(AvahiInterface *i, AvahiRecord *p, gboolean immediately);
110 void avahi_interface_post_response(AvahiInterface *i, const AvahiAddress *a, AvahiRecord *record, gboolean flush_cache, gboolean immediately);
111
112 void avahi_dump_caches(AvahiInterfaceMonitor *m, FILE *f);
113
114 gboolean avahi_interface_relevant(AvahiInterface *i);
115 gboolean avahi_interface_address_relevant(AvahiInterfaceAddress *a);
116
117 gboolean avahi_interface_match(AvahiInterface *i, gint index, guchar protocol);
118
119 typedef void (*AvahiInterfaceMonitorWalkCallback)(AvahiInterfaceMonitor *m, AvahiInterface *i, gpointer userdata);
120     
121 void avahi_interface_monitor_walk(AvahiInterfaceMonitor *m, gint index, guchar protocol, AvahiInterfaceMonitorWalkCallback callback, gpointer userdata);
122
123 #endif