]> git.meshlink.io Git - catta/blob - avahi-client/lookup.h
adda note to avahi_service_resolver_new() to remind people to pass the correct interf...
[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 /** A domain browser object */
44 typedef struct AvahiDomainBrowser AvahiDomainBrowser;
45
46 /** A service browser object */
47 typedef struct AvahiServiceBrowser AvahiServiceBrowser;
48
49 /** A service type browser object */
50 typedef struct AvahiServiceTypeBrowser AvahiServiceTypeBrowser;
51
52 /** A service resolver object */
53 typedef struct AvahiServiceResolver AvahiServiceResolver;
54
55 /** A service resolver object */
56 typedef struct AvahiHostNameResolver AvahiHostNameResolver;
57
58 /** An address resolver object */
59 typedef struct AvahiAddressResolver AvahiAddressResolver;
60
61 /** A record browser object */
62 typedef struct AvahiRecordBrowser AvahiRecordBrowser;
63
64 /** The function prototype for the callback of an AvahiDomainBrowser */
65 typedef void (*AvahiDomainBrowserCallback) (
66     AvahiDomainBrowser *b,
67     AvahiIfIndex interface,
68     AvahiProtocol protocol,
69     AvahiBrowserEvent event,
70     const char *domain,
71     AvahiLookupResultFlags flags,
72     void *userdata);
73
74 /** The function prototype for the callback of an AvahiServiceBrowser */
75 typedef void (*AvahiServiceBrowserCallback) (
76     AvahiServiceBrowser *b,
77     AvahiIfIndex interface,
78     AvahiProtocol protocol,
79     AvahiBrowserEvent event,
80     const char *name,
81     const char *type,
82     const char *domain,
83     AvahiLookupResultFlags flags,
84     void *userdata);
85
86 /** The function prototype for the callback of an AvahiServiceTypeBrowser */
87 typedef void (*AvahiServiceTypeBrowserCallback) (
88     AvahiServiceTypeBrowser *b,
89     AvahiIfIndex interface,
90     AvahiProtocol protocol,
91     AvahiBrowserEvent event,
92     const char *type,
93     const char *domain,
94     AvahiLookupResultFlags flags,
95     void *userdata);
96
97 /** The function prototype for the callback of an AvahiServiceResolver */
98 typedef void (*AvahiServiceResolverCallback) (
99     AvahiServiceResolver *r,
100     AvahiIfIndex interface,
101     AvahiProtocol protocol,
102     AvahiResolverEvent event,
103     const char *name,
104     const char *type,
105     const char *domain,
106     const char *host_name,
107     const AvahiAddress *a,
108     uint16_t port,
109     AvahiStringList *txt,
110     AvahiLookupResultFlags flags, 
111     void *userdata);
112
113 /** The function prototype for the callback of an AvahiHostNameResolver */
114 typedef void (*AvahiHostNameResolverCallback) (
115     AvahiHostNameResolver *r,
116     AvahiIfIndex interface,
117     AvahiProtocol protocol,
118     AvahiResolverEvent event,
119     const char *name,
120     const AvahiAddress *a,
121     AvahiLookupResultFlags flags, 
122     void *userdata);
123
124 /** The function prototype for the callback of an AvahiAddressResolver */
125 typedef void (*AvahiAddressResolverCallback) (
126     AvahiAddressResolver *r,
127     AvahiIfIndex interface,
128     AvahiProtocol protocol,
129     AvahiResolverEvent event,
130     const AvahiAddress *a,
131     const char *name,
132     AvahiLookupResultFlags flags, 
133     void *userdata);
134
135 /** The function prototype for the callback of an AvahiRecordBrowser */
136 typedef void (*AvahiRecordBrowserCallback) (
137     AvahiRecordBrowser *b,
138     AvahiIfIndex interface,
139     AvahiProtocol protocol,
140     AvahiBrowserEvent event,
141     const char *name,
142     uint16_t clazz,
143     uint16_t type,
144     const void *rdata,
145     size_t size,
146     AvahiLookupResultFlags flags,
147     void *userdata);
148
149 /** Browse for domains on the local network */
150 AvahiDomainBrowser* avahi_domain_browser_new (
151     AvahiClient *client,
152     AvahiIfIndex interface,
153     AvahiProtocol protocol,
154     const char *domain,
155     AvahiDomainBrowserType btype,
156     AvahiLookupFlags flags,
157     AvahiDomainBrowserCallback callback,
158     void *userdata);
159
160 /** Get the parent client of an AvahiDomainBrowser object */
161 AvahiClient* avahi_domain_browser_get_client (AvahiDomainBrowser *);
162
163 /** Cleans up and frees an AvahiDomainBrowser object */
164 int avahi_domain_browser_free (AvahiDomainBrowser *);
165
166 /** Browse for service types on the local network */
167 AvahiServiceTypeBrowser* avahi_service_type_browser_new (
168     AvahiClient *client,
169     AvahiIfIndex interface,
170     AvahiProtocol protocol,
171     const char *domain,
172     AvahiLookupFlags flags,
173     AvahiServiceTypeBrowserCallback callback,
174     void *userdata);
175
176 /** Get the parent client of an AvahiServiceTypeBrowser object */
177 AvahiClient* avahi_service_type_browser_get_client (AvahiServiceTypeBrowser *);
178
179 /** Cleans up and frees an AvahiServiceTypeBrowser object */
180 int avahi_service_type_browser_free (AvahiServiceTypeBrowser *);
181
182 /** Browse for services of a type on the local network */
183 AvahiServiceBrowser* avahi_service_browser_new (
184     AvahiClient *client,
185     AvahiIfIndex interface,
186     AvahiProtocol protocol,
187     const char *type,
188     const char *domain,
189     AvahiLookupFlags flags,
190     AvahiServiceBrowserCallback callback,
191     void *userdata);
192
193 /** Get the parent client of an AvahiServiceBrowser object */
194 AvahiClient* avahi_service_browser_get_client (AvahiServiceBrowser *);
195
196 /** Cleans up and frees an AvahiServiceBrowser object */
197 int avahi_service_browser_free (AvahiServiceBrowser *);
198
199 /** Create a new service resolver object. Please make sure to pass all
200  * the service data you received via avahi_service_browser_new()'s
201  * callback function, especially interface and protocol. */
202 AvahiServiceResolver * avahi_service_resolver_new(
203     AvahiClient *client,
204     AvahiIfIndex interface,
205     AvahiProtocol protocol,
206     const char *name,
207     const char *type,
208     const char *domain,
209     AvahiProtocol aprotocol,
210     AvahiLookupFlags flags,
211     AvahiServiceResolverCallback callback,
212     void *userdata);
213
214 /** Get the parent client of an AvahiServiceResolver object */
215 AvahiClient* avahi_service_resolver_get_client (AvahiServiceResolver *);
216
217 /** Free a service resolver object */
218 int avahi_service_resolver_free(AvahiServiceResolver *r);
219
220 /** Create a new hostname resolver object */
221 AvahiHostNameResolver * avahi_host_name_resolver_new(
222     AvahiClient *client,
223     AvahiIfIndex interface,
224     AvahiProtocol protocol,
225     const char *name,
226     AvahiProtocol aprotocol,
227     AvahiLookupFlags flags,
228     AvahiHostNameResolverCallback callback,
229     void *userdata);
230
231 /** Get the parent client of an AvahiHostNameResolver object */
232 AvahiClient* avahi_host_name_resolver_get_client (AvahiHostNameResolver *);
233
234 /** Free a hostname resolver object */
235 int avahi_host_name_resolver_free(AvahiHostNameResolver *r);
236
237 /** Create a new address resolver object from an AvahiAddress object */
238 AvahiAddressResolver* avahi_address_resolver_new(
239     AvahiClient *client,
240     AvahiIfIndex interface,
241     AvahiProtocol protocol,
242     const AvahiAddress *a,
243     AvahiLookupFlags flags,
244     AvahiAddressResolverCallback callback,
245     void *userdata);
246
247 /** Get the parent client of an AvahiAddressResolver object */
248 AvahiClient* avahi_address_resolver_get_client (AvahiAddressResolver *);
249
250 /** Free a AvahiAddressResolver resolver object */
251 int avahi_address_resolver_free(AvahiAddressResolver *r);
252
253 /** Browse for records of a type on the local network */
254 AvahiRecordBrowser* avahi_record_browser_new(
255     AvahiClient *client,
256     AvahiIfIndex interface,
257     AvahiProtocol protocol,
258     const char *name,
259     uint16_t clazz,
260     uint16_t type,
261     AvahiLookupFlags flags,
262     AvahiRecordBrowserCallback callback,
263     void *userdata);
264
265 /** Get the parent client of an AvahiRecordBrowser object */
266 AvahiClient* avahi_record_browser_get_client(AvahiRecordBrowser *);
267
268 /** Cleans up and frees an AvahiRecordBrowser object */
269 int avahi_record_browser_free(AvahiRecordBrowser *);
270
271 AVAHI_C_DECL_END
272
273 #endif