1 #ifndef foodbusinternalhfoo
2 #define foodbusinternalhfoo
7 This file is part of avahi.
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.
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.
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
26 #include <dbus/dbus.h>
28 #include <avahi-core/core.h>
29 #include <avahi-core/publish.h>
30 #include <avahi-core/lookup.h>
32 #include <avahi-common/llist.h>
34 typedef struct Server Server;
35 typedef struct Client Client;
36 typedef struct EntryGroupInfo EntryGroupInfo;
37 typedef struct SyncHostNameResolverInfo SyncHostNameResolverInfo;
38 typedef struct AsyncHostNameResolverInfo AsyncHostNameResolverInfo;
39 typedef struct SyncAddressResolverInfo SyncAddressResolverInfo;
40 typedef struct AsyncAddressResolverInfo AsyncAddressResolverInfo;
41 typedef struct DomainBrowserInfo DomainBrowserInfo;
42 typedef struct ServiceTypeBrowserInfo ServiceTypeBrowserInfo;
43 typedef struct ServiceBrowserInfo ServiceBrowserInfo;
44 typedef struct SyncServiceResolverInfo SyncServiceResolverInfo;
45 typedef struct AsyncServiceResolverInfo AsyncServiceResolverInfo;
46 typedef struct RecordBrowserInfo RecordBrowserInfo;
48 #define CLIENTS_MAX 256
49 #define OBJECTS_PER_CLIENT_MAX 250
50 #define ENTRIES_PER_ENTRY_GROUP_MAX 20
52 struct EntryGroupInfo {
55 AvahiSEntryGroup *entry_group;
60 AVAHI_LLIST_FIELDS(EntryGroupInfo, entry_groups);
63 struct SyncHostNameResolverInfo {
65 AvahiSHostNameResolver *host_name_resolver;
68 AVAHI_LLIST_FIELDS(SyncHostNameResolverInfo, sync_host_name_resolvers);
71 struct AsyncHostNameResolverInfo {
74 AvahiSHostNameResolver *host_name_resolver;
77 AVAHI_LLIST_FIELDS(AsyncHostNameResolverInfo, async_host_name_resolvers);
80 struct SyncAddressResolverInfo {
82 AvahiSAddressResolver *address_resolver;
85 AVAHI_LLIST_FIELDS(SyncAddressResolverInfo, sync_address_resolvers);
88 struct AsyncAddressResolverInfo {
91 AvahiSAddressResolver *address_resolver;
94 AVAHI_LLIST_FIELDS(AsyncAddressResolverInfo, async_address_resolvers);
97 struct DomainBrowserInfo {
100 AvahiSDomainBrowser *domain_browser;
103 AVAHI_LLIST_FIELDS(DomainBrowserInfo, domain_browsers);
106 struct ServiceTypeBrowserInfo {
109 AvahiSServiceTypeBrowser *service_type_browser;
112 AVAHI_LLIST_FIELDS(ServiceTypeBrowserInfo, service_type_browsers);
115 struct ServiceBrowserInfo {
118 AvahiSServiceBrowser *service_browser;
121 AVAHI_LLIST_FIELDS(ServiceBrowserInfo, service_browsers);
124 struct SyncServiceResolverInfo {
126 AvahiSServiceResolver *service_resolver;
127 DBusMessage *message;
129 AVAHI_LLIST_FIELDS(SyncServiceResolverInfo, sync_service_resolvers);
132 struct AsyncServiceResolverInfo {
135 AvahiSServiceResolver *service_resolver;
138 AVAHI_LLIST_FIELDS(AsyncServiceResolverInfo, async_service_resolvers);
141 struct RecordBrowserInfo {
144 AvahiSRecordBrowser *record_browser;
147 AVAHI_LLIST_FIELDS(RecordBrowserInfo, record_browsers);
156 AVAHI_LLIST_FIELDS(Client, clients);
157 AVAHI_LLIST_HEAD(EntryGroupInfo, entry_groups);
158 AVAHI_LLIST_HEAD(SyncHostNameResolverInfo, sync_host_name_resolvers);
159 AVAHI_LLIST_HEAD(AsyncHostNameResolverInfo, async_host_name_resolvers);
160 AVAHI_LLIST_HEAD(SyncAddressResolverInfo, sync_address_resolvers);
161 AVAHI_LLIST_HEAD(AsyncAddressResolverInfo, async_address_resolvers);
162 AVAHI_LLIST_HEAD(DomainBrowserInfo, domain_browsers);
163 AVAHI_LLIST_HEAD(ServiceTypeBrowserInfo, service_type_browsers);
164 AVAHI_LLIST_HEAD(ServiceBrowserInfo, service_browsers);
165 AVAHI_LLIST_HEAD(SyncServiceResolverInfo, sync_service_resolvers);
166 AVAHI_LLIST_HEAD(AsyncServiceResolverInfo, async_service_resolvers);
167 AVAHI_LLIST_HEAD(RecordBrowserInfo, record_browsers);
171 const AvahiPoll *poll_api;
173 AVAHI_LLIST_HEAD(Client, clients);
177 AvahiTimeout *reconnect_timeout;
181 extern Server *server;
183 void avahi_dbus_entry_group_free(EntryGroupInfo *i);
184 void avahi_dbus_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void* userdata);
185 DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage *m, void *userdata);
187 void avahi_dbus_sync_host_name_resolver_free(SyncHostNameResolverInfo *i);
188 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);
190 void avahi_dbus_async_host_name_resolver_free(AsyncHostNameResolverInfo *i);
191 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);
192 DBusHandlerResult avahi_dbus_msg_async_host_name_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata);
194 void avahi_dbus_sync_address_resolver_free(SyncAddressResolverInfo *i);
195 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);
197 void avahi_dbus_async_address_resolver_free(AsyncAddressResolverInfo *i);
198 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);
199 DBusHandlerResult avahi_dbus_msg_async_address_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata);
201 void avahi_dbus_domain_browser_free(DomainBrowserInfo *i);
202 DBusHandlerResult avahi_dbus_msg_domain_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata);
203 void avahi_dbus_domain_browser_callback(AvahiSDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *domain, AvahiLookupResultFlags flags, void* userdata);
205 void avahi_dbus_service_type_browser_free(ServiceTypeBrowserInfo *i);
206 DBusHandlerResult avahi_dbus_msg_service_type_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata);
207 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);
209 void avahi_dbus_service_browser_free(ServiceBrowserInfo *i);
210 DBusHandlerResult avahi_dbus_msg_service_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata);
211 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);
213 void avahi_dbus_sync_service_resolver_free(SyncServiceResolverInfo *i);
215 void avahi_dbus_sync_service_resolver_callback(
216 AvahiSServiceResolver *r,
217 AvahiIfIndex interface,
218 AvahiProtocol protocol,
219 AvahiResolverEvent event,
223 const char *host_name,
224 const AvahiAddress *a,
226 AvahiStringList *txt,
227 AvahiLookupResultFlags flags,
230 void avahi_dbus_async_service_resolver_free(AsyncServiceResolverInfo *i);
231 void avahi_dbus_async_service_resolver_callback(
232 AvahiSServiceResolver *r,
233 AvahiIfIndex interface,
234 AvahiProtocol protocol,
235 AvahiResolverEvent event,
239 const char *host_name,
240 const AvahiAddress *a,
242 AvahiStringList *txt,
243 AvahiLookupResultFlags flags,
246 DBusHandlerResult avahi_dbus_msg_async_service_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata);
248 void avahi_dbus_record_browser_free(RecordBrowserInfo *i);
249 DBusHandlerResult avahi_dbus_msg_record_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata);
250 void avahi_dbus_record_browser_callback(AvahiSRecordBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, AvahiLookupResultFlags flags, void* userdata);