]> git.meshlink.io Git - catta/blob - avahi-client/internal.h
* Implement client API for arbitrary record browsing
[catta] / avahi-client / internal.h
1 #ifndef foointernalhfoo
2 #define foointernalhfoo
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 <dbus/dbus.h>
26
27 #include "client.h"
28 #include "lookup.h"
29 #include "publish.h"
30
31 struct AvahiClient {
32     const AvahiPoll *poll_api;
33     DBusConnection *bus;
34     int error;
35     AvahiClientState state;
36     AvahiClientFlags flags;
37
38     /* Cache for some seldom changing server data */
39     char *version_string, *host_name, *host_name_fqdn, *domain_name;
40     uint32_t local_service_cookie;
41     int local_service_cookie_valid;
42     
43     AvahiClientCallback callback;
44     void *userdata;
45     
46     AVAHI_LLIST_HEAD(AvahiEntryGroup, groups);
47     AVAHI_LLIST_HEAD(AvahiDomainBrowser, domain_browsers);
48     AVAHI_LLIST_HEAD(AvahiServiceBrowser, service_browsers);
49     AVAHI_LLIST_HEAD(AvahiServiceTypeBrowser, service_type_browsers);
50     AVAHI_LLIST_HEAD(AvahiServiceResolver, service_resolvers);
51     AVAHI_LLIST_HEAD(AvahiHostNameResolver, host_name_resolvers);
52     AVAHI_LLIST_HEAD(AvahiAddressResolver, address_resolvers);
53     AVAHI_LLIST_HEAD(AvahiRecordBrowser, record_browsers);
54 };
55
56 struct AvahiEntryGroup {
57     char *path;
58     AvahiEntryGroupState state;
59     AvahiClient *client;
60     AvahiEntryGroupCallback callback;
61     void *userdata;
62     AVAHI_LLIST_FIELDS(AvahiEntryGroup, groups);
63 };
64
65 struct AvahiDomainBrowser {
66     int ref;
67     
68     char *path;
69     AvahiClient *client;
70     AvahiDomainBrowserCallback callback;
71     void *userdata;
72     AVAHI_LLIST_FIELDS(AvahiDomainBrowser, domain_browsers);
73
74     AvahiIfIndex interface;
75     AvahiProtocol protocol;
76
77     AvahiTimeout *defer_timeout;
78
79     AvahiStringList *static_browse_domains;
80 };
81
82 struct AvahiServiceBrowser {
83     char *path;
84     AvahiClient *client;
85     AvahiServiceBrowserCallback callback;
86     void *userdata;
87     AVAHI_LLIST_FIELDS(AvahiServiceBrowser, service_browsers);
88
89     char *type, *domain;
90     AvahiIfIndex interface;
91     AvahiProtocol protocol;
92 };
93
94 struct AvahiServiceTypeBrowser {
95     char *path;
96     AvahiClient *client;
97     AvahiServiceTypeBrowserCallback callback;
98     void *userdata;
99     AVAHI_LLIST_FIELDS(AvahiServiceTypeBrowser, service_type_browsers);
100
101     char *domain;
102     AvahiIfIndex interface;
103     AvahiProtocol protocol;
104 };
105
106 struct AvahiServiceResolver {
107     char *path;
108     AvahiClient *client;
109     AvahiServiceResolverCallback callback;
110     void *userdata;
111     AVAHI_LLIST_FIELDS(AvahiServiceResolver, service_resolvers);
112
113     char *name, *type, *domain;
114     AvahiIfIndex interface;
115     AvahiProtocol protocol;
116 };
117
118 struct AvahiHostNameResolver {
119     char *path;
120     AvahiClient *client;
121     AvahiHostNameResolverCallback callback;
122     void *userdata;
123     AVAHI_LLIST_FIELDS(AvahiHostNameResolver, host_name_resolvers);
124
125     char *host_name;
126     AvahiIfIndex interface;
127     AvahiProtocol protocol;
128 };
129
130 struct AvahiAddressResolver {
131     char *path;
132     AvahiClient *client;
133     AvahiAddressResolverCallback callback;
134     void *userdata;
135     AVAHI_LLIST_FIELDS(AvahiAddressResolver, address_resolvers);
136
137     AvahiAddress address;
138     AvahiIfIndex interface;
139     AvahiProtocol protocol;
140 };
141
142 struct AvahiRecordBrowser {
143     char *path;
144     AvahiClient *client;
145     AvahiRecordBrowserCallback callback;
146     void *userdata;
147     AVAHI_LLIST_FIELDS(AvahiRecordBrowser, record_browsers);
148
149     char *name;
150     uint16_t clazz, type;
151     AvahiIfIndex interface;
152     AvahiProtocol protocol;
153 };
154
155 int avahi_client_set_errno (AvahiClient *client, int error);
156 int avahi_client_set_dbus_error(AvahiClient *client, DBusError *error);
157
158 void avahi_entry_group_set_state(AvahiEntryGroup *group, AvahiEntryGroupState state);
159
160 DBusHandlerResult avahi_domain_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
161 DBusHandlerResult avahi_service_type_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
162 DBusHandlerResult avahi_service_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
163 DBusHandlerResult avahi_record_browser_event(AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
164
165 DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message);
166 DBusHandlerResult avahi_host_name_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message);
167 DBusHandlerResult avahi_address_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message);
168
169 int avahi_client_simple_method_call(AvahiClient *client, const char *path, const char *interface, const char *method);
170
171 int avahi_client_is_connected(AvahiClient *client);
172
173 #endif