]> git.meshlink.io Git - catta/blob - avahi-daemon/dbus-internal.h
get rid of a lot of old svn cruft
[catta] / avahi-daemon / dbus-internal.h
1 #ifndef foodbusinternalhfoo
2 #define foodbusinternalhfoo
3
4 /***
5   This file is part of avahi.
6
7   avahi is free software; you can redistribute it and/or modify it
8   under the terms of the GNU Lesser General Public License as
9   published by the Free Software Foundation; either version 2.1 of the
10   License, or (at your option) any later version.
11
12   avahi is distributed in the hope that it will be useful, but WITHOUT
13   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14   or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
15   Public License for more details.
16
17   You should have received a copy of the GNU Lesser General Public
18   License along with avahi; if not, write to the Free Software
19   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20   USA.
21 ***/
22
23
24 #include <dbus/dbus.h>
25
26 #include <avahi-core/core.h>
27 #include <avahi-core/publish.h>
28 #include <avahi-core/lookup.h>
29
30 #include <avahi-common/llist.h>
31
32 typedef struct Server Server;
33 typedef struct Client Client;
34 typedef struct EntryGroupInfo EntryGroupInfo;
35 typedef struct SyncHostNameResolverInfo SyncHostNameResolverInfo;
36 typedef struct AsyncHostNameResolverInfo AsyncHostNameResolverInfo;
37 typedef struct SyncAddressResolverInfo SyncAddressResolverInfo;
38 typedef struct AsyncAddressResolverInfo AsyncAddressResolverInfo;
39 typedef struct DomainBrowserInfo DomainBrowserInfo;
40 typedef struct ServiceTypeBrowserInfo ServiceTypeBrowserInfo;
41 typedef struct ServiceBrowserInfo ServiceBrowserInfo;
42 typedef struct SyncServiceResolverInfo SyncServiceResolverInfo;
43 typedef struct AsyncServiceResolverInfo AsyncServiceResolverInfo;
44 typedef struct RecordBrowserInfo RecordBrowserInfo;
45
46 #define CLIENTS_MAX 256
47 #define OBJECTS_PER_CLIENT_MAX 250
48 #define ENTRIES_PER_ENTRY_GROUP_MAX 20
49
50 struct EntryGroupInfo {
51     unsigned id;
52     Client *client;
53     AvahiSEntryGroup *entry_group;
54     char *path;
55
56     int n_entries;
57
58     AVAHI_LLIST_FIELDS(EntryGroupInfo, entry_groups);
59 };
60
61 struct SyncHostNameResolverInfo {
62     Client *client;
63     AvahiSHostNameResolver *host_name_resolver;
64     DBusMessage *message;
65
66     AVAHI_LLIST_FIELDS(SyncHostNameResolverInfo, sync_host_name_resolvers);
67 };
68
69 struct AsyncHostNameResolverInfo {
70     unsigned id;
71     Client *client;
72     AvahiSHostNameResolver *host_name_resolver;
73     char *path;
74
75     AVAHI_LLIST_FIELDS(AsyncHostNameResolverInfo, async_host_name_resolvers);
76 };
77
78 struct SyncAddressResolverInfo {
79     Client *client;
80     AvahiSAddressResolver *address_resolver;
81     DBusMessage *message;
82
83     AVAHI_LLIST_FIELDS(SyncAddressResolverInfo, sync_address_resolvers);
84 };
85
86 struct AsyncAddressResolverInfo {
87     unsigned id;
88     Client *client;
89     AvahiSAddressResolver *address_resolver;
90     char *path;
91
92     AVAHI_LLIST_FIELDS(AsyncAddressResolverInfo, async_address_resolvers);
93 };
94
95 struct DomainBrowserInfo {
96     unsigned id;
97     Client *client;
98     AvahiSDomainBrowser *domain_browser;
99     char *path;
100
101     AVAHI_LLIST_FIELDS(DomainBrowserInfo, domain_browsers);
102 };
103
104 struct ServiceTypeBrowserInfo {
105     unsigned id;
106     Client *client;
107     AvahiSServiceTypeBrowser *service_type_browser;
108     char *path;
109
110     AVAHI_LLIST_FIELDS(ServiceTypeBrowserInfo, service_type_browsers);
111 };
112
113 struct ServiceBrowserInfo {
114     unsigned id;
115     Client *client;
116     AvahiSServiceBrowser *service_browser;
117     char *path;
118
119     AVAHI_LLIST_FIELDS(ServiceBrowserInfo, service_browsers);
120 };
121
122 struct SyncServiceResolverInfo {
123     Client *client;
124     AvahiSServiceResolver *service_resolver;
125     DBusMessage *message;
126
127     AVAHI_LLIST_FIELDS(SyncServiceResolverInfo, sync_service_resolvers);
128 };
129
130 struct AsyncServiceResolverInfo {
131     unsigned id;
132     Client *client;
133     AvahiSServiceResolver *service_resolver;
134     char *path;
135
136     AVAHI_LLIST_FIELDS(AsyncServiceResolverInfo, async_service_resolvers);
137 };
138
139 struct RecordBrowserInfo {
140     unsigned id;
141     Client *client;
142     AvahiSRecordBrowser *record_browser;
143     char *path;
144
145     AVAHI_LLIST_FIELDS(RecordBrowserInfo, record_browsers);
146 };
147
148 struct Client {
149     unsigned id;
150     char *name;
151     unsigned current_id;
152     int n_objects;
153
154     AVAHI_LLIST_FIELDS(Client, clients);
155     AVAHI_LLIST_HEAD(EntryGroupInfo, entry_groups);
156     AVAHI_LLIST_HEAD(SyncHostNameResolverInfo, sync_host_name_resolvers);
157     AVAHI_LLIST_HEAD(AsyncHostNameResolverInfo, async_host_name_resolvers);
158     AVAHI_LLIST_HEAD(SyncAddressResolverInfo, sync_address_resolvers);
159     AVAHI_LLIST_HEAD(AsyncAddressResolverInfo, async_address_resolvers);
160     AVAHI_LLIST_HEAD(DomainBrowserInfo, domain_browsers);
161     AVAHI_LLIST_HEAD(ServiceTypeBrowserInfo, service_type_browsers);
162     AVAHI_LLIST_HEAD(ServiceBrowserInfo, service_browsers);
163     AVAHI_LLIST_HEAD(SyncServiceResolverInfo, sync_service_resolvers);
164     AVAHI_LLIST_HEAD(AsyncServiceResolverInfo, async_service_resolvers);
165     AVAHI_LLIST_HEAD(RecordBrowserInfo, record_browsers);
166 };
167
168 struct Server {
169     const AvahiPoll *poll_api;
170     DBusConnection *bus;
171     AVAHI_LLIST_HEAD(Client, clients);
172     int n_clients;
173     unsigned current_id;
174
175     AvahiTimeout *reconnect_timeout;
176     int reconnect;
177 };
178
179 extern Server *server;
180
181 void avahi_dbus_entry_group_free(EntryGroupInfo *i);
182 void avahi_dbus_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void* userdata);
183 DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage *m, void *userdata);
184
185 void avahi_dbus_sync_host_name_resolver_free(SyncHostNameResolverInfo *i);
186 void avahi_dbus_sync_host_name_resolver_callback(AvahiSHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char *host_name, const AvahiAddress *a, AvahiLookupResultFlags flags, void* userdata);
187
188 void avahi_dbus_async_host_name_resolver_free(AsyncHostNameResolverInfo *i);
189 void avahi_dbus_async_host_name_resolver_callback(AvahiSHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char *host_name, const AvahiAddress *a, AvahiLookupResultFlags flags, void* userdata);
190 DBusHandlerResult avahi_dbus_msg_async_host_name_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata);
191
192 void avahi_dbus_sync_address_resolver_free(SyncAddressResolverInfo *i);
193 void avahi_dbus_sync_address_resolver_callback(AvahiSAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const AvahiAddress *address, const char *host_name, AvahiLookupResultFlags flags, void* userdata);
194
195 void avahi_dbus_async_address_resolver_free(AsyncAddressResolverInfo *i);
196 void avahi_dbus_async_address_resolver_callback(AvahiSAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const AvahiAddress *address, const char *host_name, AvahiLookupResultFlags flags, void* userdata);
197 DBusHandlerResult avahi_dbus_msg_async_address_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata);
198
199 void avahi_dbus_domain_browser_free(DomainBrowserInfo *i);
200 DBusHandlerResult avahi_dbus_msg_domain_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata);
201 void avahi_dbus_domain_browser_callback(AvahiSDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *domain, AvahiLookupResultFlags flags,  void* userdata);
202
203 void avahi_dbus_service_type_browser_free(ServiceTypeBrowserInfo *i);
204 DBusHandlerResult avahi_dbus_msg_service_type_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata);
205 void avahi_dbus_service_type_browser_callback(AvahiSServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *type, const char *domain, AvahiLookupResultFlags flags, void* userdata);
206
207 void avahi_dbus_service_browser_free(ServiceBrowserInfo *i);
208 DBusHandlerResult avahi_dbus_msg_service_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata);
209 void avahi_dbus_service_browser_callback(AvahiSServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, const char *type, const char *domain, AvahiLookupResultFlags flags, void* userdata);
210
211 void avahi_dbus_sync_service_resolver_free(SyncServiceResolverInfo *i);
212
213 void avahi_dbus_sync_service_resolver_callback(
214     AvahiSServiceResolver *r,
215     AvahiIfIndex interface,
216     AvahiProtocol protocol,
217     AvahiResolverEvent event,
218     const char *name,
219     const char *type,
220     const char *domain,
221     const char *host_name,
222     const AvahiAddress *a,
223     uint16_t port,
224     AvahiStringList *txt,
225     AvahiLookupResultFlags flags,
226     void* userdata);
227
228 void avahi_dbus_async_service_resolver_free(AsyncServiceResolverInfo *i);
229 void avahi_dbus_async_service_resolver_callback(
230     AvahiSServiceResolver *r,
231     AvahiIfIndex interface,
232     AvahiProtocol protocol,
233     AvahiResolverEvent event,
234     const char *name,
235     const char *type,
236     const char *domain,
237     const char *host_name,
238     const AvahiAddress *a,
239     uint16_t port,
240     AvahiStringList *txt,
241     AvahiLookupResultFlags flags,
242     void* userdata);
243
244 DBusHandlerResult avahi_dbus_msg_async_service_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata);
245
246 void avahi_dbus_record_browser_free(RecordBrowserInfo *i);
247 DBusHandlerResult avahi_dbus_msg_record_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata);
248 void avahi_dbus_record_browser_callback(AvahiSRecordBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, AvahiLookupResultFlags flags, void* userdata);
249
250 #endif