]> git.meshlink.io Git - catta/blob - avahi-client/lookup.h
document the meaning of aprotocol in avahi_service_resolver_new(), closes #179
[catta] / avahi-client / lookup.h
1 #ifndef fooclientlookuphfoo
2 #define fooclientlookuphfoo
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 <inttypes.h>
26
27 #include <avahi-common/cdecl.h>
28 #include <avahi-common/address.h>
29 #include <avahi-common/strlst.h>
30 #include <avahi-common/defs.h>
31 #include <avahi-common/watch.h>
32 #include <avahi-common/gccmacro.h>
33
34 #include <avahi-client/client.h>
35
36 /** \file avahi-client/lookup.h Lookup Client API */
37
38 /** \example client-browse-services.c Example how to browse for DNS-SD
39  * services using the client interface to avahi-daemon. */
40
41 AVAHI_C_DECL_BEGIN
42
43 /** @{ \name Domain Browser */
44
45 /** A domain browser object */
46 typedef struct AvahiDomainBrowser AvahiDomainBrowser;
47
48 /** The function prototype for the callback of an AvahiDomainBrowser */
49 typedef void (*AvahiDomainBrowserCallback) (
50     AvahiDomainBrowser *b,
51     AvahiIfIndex interface,
52     AvahiProtocol protocol,
53     AvahiBrowserEvent event,
54     const char *domain,
55     AvahiLookupResultFlags flags,
56     void *userdata);
57
58 /** Browse for domains on the local network */
59 AvahiDomainBrowser* avahi_domain_browser_new (
60     AvahiClient *client,
61     AvahiIfIndex interface,
62     AvahiProtocol protocol,
63     const char *domain,
64     AvahiDomainBrowserType btype,
65     AvahiLookupFlags flags,
66     AvahiDomainBrowserCallback callback,
67     void *userdata);
68
69 /** Get the parent client of an AvahiDomainBrowser object */
70 AvahiClient* avahi_domain_browser_get_client (AvahiDomainBrowser *);
71
72 /** Cleans up and frees an AvahiDomainBrowser object */
73 int avahi_domain_browser_free (AvahiDomainBrowser *);
74
75 /** @} */
76
77 /** @{ \name Service Browser */
78
79 /** A service browser object */
80 typedef struct AvahiServiceBrowser AvahiServiceBrowser;
81
82 /** The function prototype for the callback of an AvahiServiceBrowser */
83 typedef void (*AvahiServiceBrowserCallback) (
84     AvahiServiceBrowser *b,
85     AvahiIfIndex interface,
86     AvahiProtocol protocol,
87     AvahiBrowserEvent event,
88     const char *name,
89     const char *type,
90     const char *domain,
91     AvahiLookupResultFlags flags,
92     void *userdata);
93
94 /** Browse for services of a type on the local network */
95 AvahiServiceBrowser* avahi_service_browser_new (
96     AvahiClient *client,
97     AvahiIfIndex interface,
98     AvahiProtocol protocol,
99     const char *type,
100     const char *domain,
101     AvahiLookupFlags flags,
102     AvahiServiceBrowserCallback callback,
103     void *userdata);
104
105 /** Get the parent client of an AvahiServiceBrowser object */
106 AvahiClient* avahi_service_browser_get_client (AvahiServiceBrowser *);
107
108 /** Cleans up and frees an AvahiServiceBrowser object */
109 int avahi_service_browser_free (AvahiServiceBrowser *);
110
111 /** @} */
112
113 /** \cond fulldocs */
114 /** A service type browser object */
115 typedef struct AvahiServiceTypeBrowser AvahiServiceTypeBrowser;
116
117 /** The function prototype for the callback of an AvahiServiceTypeBrowser */
118 typedef void (*AvahiServiceTypeBrowserCallback) (
119     AvahiServiceTypeBrowser *b,
120     AvahiIfIndex interface,
121     AvahiProtocol protocol,
122     AvahiBrowserEvent event,
123     const char *type,
124     const char *domain,
125     AvahiLookupResultFlags flags,
126     void *userdata);
127
128 /** Browse for service types on the local network */
129 AvahiServiceTypeBrowser* avahi_service_type_browser_new (
130     AvahiClient *client,
131     AvahiIfIndex interface,
132     AvahiProtocol protocol,
133     const char *domain,
134     AvahiLookupFlags flags,
135     AvahiServiceTypeBrowserCallback callback,
136     void *userdata);
137
138 /** Get the parent client of an AvahiServiceTypeBrowser object */
139 AvahiClient* avahi_service_type_browser_get_client (AvahiServiceTypeBrowser *);
140
141 /** Cleans up and frees an AvahiServiceTypeBrowser object */
142 int avahi_service_type_browser_free (AvahiServiceTypeBrowser *);
143
144 /** \endcond */
145
146 /** @{ \name Service Resolver */
147
148 /** A service resolver object */
149 typedef struct AvahiServiceResolver AvahiServiceResolver;
150
151 /** The function prototype for the callback of an AvahiServiceResolver */
152 typedef void (*AvahiServiceResolverCallback) (
153     AvahiServiceResolver *r,
154     AvahiIfIndex interface,
155     AvahiProtocol protocol,
156     AvahiResolverEvent event,
157     const char *name,
158     const char *type,
159     const char *domain,
160     const char *host_name,
161     const AvahiAddress *a,
162     uint16_t port,
163     AvahiStringList *txt,
164     AvahiLookupResultFlags flags,
165     void *userdata);
166
167 /** Create a new service resolver object. Please make sure to pass all
168  * the service data you received via avahi_service_browser_new()'s
169  * callback function, especially interface and protocol. The protocol
170  * argument specifies the protocol (IPv4 or IPv6) to use as transport
171  * for the queries which are sent out by this resolver. The
172  * aprotocol argument specifies the adress family (IPv4 or IPv6) of
173  * the address of the service we are looking for. Generally, on
174  * "protocol" you should only pass what was supplied to you as
175  * parameter to your AvahiServiceBrowserCallback. In "aprotocol" you
176  * should pass what your application code can deal with when
177  * connecting to the service. Or, more technically speaking: protocol
178  * specifies if the mDNS queries should be sent as UDP/IPv4
179  * resp. UDP/IPv6 packets. aprotocol specifies whether the query is for a A
180  * resp. AAAA resource record. */
181 AvahiServiceResolver * avahi_service_resolver_new(
182     AvahiClient *client,
183     AvahiIfIndex interface,
184     AvahiProtocol protocol,
185     const char *name,
186     const char *type,
187     const char *domain,
188     AvahiProtocol aprotocol,
189     AvahiLookupFlags flags,
190     AvahiServiceResolverCallback callback,
191     void *userdata);
192
193 /** Get the parent client of an AvahiServiceResolver object */
194 AvahiClient* avahi_service_resolver_get_client (AvahiServiceResolver *);
195
196 /** Free a service resolver object */
197 int avahi_service_resolver_free(AvahiServiceResolver *r);
198
199 /** @} */
200
201 /** \cond fulldocs */
202 /** A service resolver object */
203 typedef struct AvahiHostNameResolver AvahiHostNameResolver;
204
205 /** The function prototype for the callback of an AvahiHostNameResolver */
206 typedef void (*AvahiHostNameResolverCallback) (
207     AvahiHostNameResolver *r,
208     AvahiIfIndex interface,
209     AvahiProtocol protocol,
210     AvahiResolverEvent event,
211     const char *name,
212     const AvahiAddress *a,
213     AvahiLookupResultFlags flags,
214     void *userdata);
215
216 /** Create a new hostname resolver object */
217 AvahiHostNameResolver * avahi_host_name_resolver_new(
218     AvahiClient *client,
219     AvahiIfIndex interface,
220     AvahiProtocol protocol,
221     const char *name,
222     AvahiProtocol aprotocol,
223     AvahiLookupFlags flags,
224     AvahiHostNameResolverCallback callback,
225     void *userdata);
226
227 /** Get the parent client of an AvahiHostNameResolver object */
228 AvahiClient* avahi_host_name_resolver_get_client (AvahiHostNameResolver *);
229
230 /** Free a hostname resolver object */
231 int avahi_host_name_resolver_free(AvahiHostNameResolver *r);
232
233 /** An address resolver object */
234 typedef struct AvahiAddressResolver AvahiAddressResolver;
235
236 /** The function prototype for the callback of an AvahiAddressResolver */
237 typedef void (*AvahiAddressResolverCallback) (
238     AvahiAddressResolver *r,
239     AvahiIfIndex interface,
240     AvahiProtocol protocol,
241     AvahiResolverEvent event,
242     const AvahiAddress *a,
243     const char *name,
244     AvahiLookupResultFlags flags,
245     void *userdata);
246
247 /** Create a new address resolver object from an AvahiAddress object */
248 AvahiAddressResolver* avahi_address_resolver_new(
249     AvahiClient *client,
250     AvahiIfIndex interface,
251     AvahiProtocol protocol,
252     const AvahiAddress *a,
253     AvahiLookupFlags flags,
254     AvahiAddressResolverCallback callback,
255     void *userdata);
256
257 /** Get the parent client of an AvahiAddressResolver object */
258 AvahiClient* avahi_address_resolver_get_client (AvahiAddressResolver *);
259
260 /** Free a AvahiAddressResolver resolver object */
261 int avahi_address_resolver_free(AvahiAddressResolver *r);
262
263 /** \endcond */
264
265 /** @{ \name Record Browser */
266
267 /** A record browser object */
268 typedef struct AvahiRecordBrowser AvahiRecordBrowser;
269
270 /** The function prototype for the callback of an AvahiRecordBrowser */
271 typedef void (*AvahiRecordBrowserCallback) (
272     AvahiRecordBrowser *b,
273     AvahiIfIndex interface,
274     AvahiProtocol protocol,
275     AvahiBrowserEvent event,
276     const char *name,
277     uint16_t clazz,
278     uint16_t type,
279     const void *rdata,
280     size_t size,
281     AvahiLookupResultFlags flags,
282     void *userdata);
283
284 /** Browse for records of a type on the local network */
285 AvahiRecordBrowser* avahi_record_browser_new(
286     AvahiClient *client,
287     AvahiIfIndex interface,
288     AvahiProtocol protocol,
289     const char *name,
290     uint16_t clazz,
291     uint16_t type,
292     AvahiLookupFlags flags,
293     AvahiRecordBrowserCallback callback,
294     void *userdata);
295
296 /** Get the parent client of an AvahiRecordBrowser object */
297 AvahiClient* avahi_record_browser_get_client(AvahiRecordBrowser *);
298
299 /** Cleans up and frees an AvahiRecordBrowser object */
300 int avahi_record_browser_free(AvahiRecordBrowser *);
301
302 /** @} */
303
304 AVAHI_C_DECL_END
305
306 #endif