1 #ifndef fooclientlookuphfoo
2 #define fooclientlookuphfoo
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
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>
34 #include <avahi-client/client.h>
36 /** \file avahi-client/lookup.h Lookup Client API */
38 /** \example client-browse-services.c Example how to browse for DNS-SD
39 * services using the client interface to avahi-daemon. */
43 /** @{ \name Domain Browser */
45 /** A domain browser object */
46 typedef struct AvahiDomainBrowser AvahiDomainBrowser;
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,
55 AvahiLookupResultFlags flags,
58 /** Browse for domains on the local network */
59 AvahiDomainBrowser* avahi_domain_browser_new (
61 AvahiIfIndex interface,
62 AvahiProtocol protocol,
64 AvahiDomainBrowserType btype,
65 AvahiLookupFlags flags,
66 AvahiDomainBrowserCallback callback,
69 /** Get the parent client of an AvahiDomainBrowser object */
70 AvahiClient* avahi_domain_browser_get_client (AvahiDomainBrowser *);
72 /** Cleans up and frees an AvahiDomainBrowser object */
73 int avahi_domain_browser_free (AvahiDomainBrowser *);
77 /** @{ \name Service Browser */
79 /** A service browser object */
80 typedef struct AvahiServiceBrowser AvahiServiceBrowser;
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,
91 AvahiLookupResultFlags flags,
94 /** Browse for services of a type on the local network */
95 AvahiServiceBrowser* avahi_service_browser_new (
97 AvahiIfIndex interface,
98 AvahiProtocol protocol,
101 AvahiLookupFlags flags,
102 AvahiServiceBrowserCallback callback,
105 /** Get the parent client of an AvahiServiceBrowser object */
106 AvahiClient* avahi_service_browser_get_client (AvahiServiceBrowser *);
108 /** Cleans up and frees an AvahiServiceBrowser object */
109 int avahi_service_browser_free (AvahiServiceBrowser *);
113 /** \cond fulldocs */
114 /** A service type browser object */
115 typedef struct AvahiServiceTypeBrowser AvahiServiceTypeBrowser;
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,
125 AvahiLookupResultFlags flags,
128 /** Browse for service types on the local network */
129 AvahiServiceTypeBrowser* avahi_service_type_browser_new (
131 AvahiIfIndex interface,
132 AvahiProtocol protocol,
134 AvahiLookupFlags flags,
135 AvahiServiceTypeBrowserCallback callback,
138 /** Get the parent client of an AvahiServiceTypeBrowser object */
139 AvahiClient* avahi_service_type_browser_get_client (AvahiServiceTypeBrowser *);
141 /** Cleans up and frees an AvahiServiceTypeBrowser object */
142 int avahi_service_type_browser_free (AvahiServiceTypeBrowser *);
146 /** @{ \name Service Resolver */
148 /** A service resolver object */
149 typedef struct AvahiServiceResolver AvahiServiceResolver;
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,
160 const char *host_name,
161 const AvahiAddress *a,
163 AvahiStringList *txt,
164 AvahiLookupResultFlags flags,
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(
183 AvahiIfIndex interface,
184 AvahiProtocol protocol,
188 AvahiProtocol aprotocol,
189 AvahiLookupFlags flags,
190 AvahiServiceResolverCallback callback,
193 /** Get the parent client of an AvahiServiceResolver object */
194 AvahiClient* avahi_service_resolver_get_client (AvahiServiceResolver *);
196 /** Free a service resolver object */
197 int avahi_service_resolver_free(AvahiServiceResolver *r);
201 /** \cond fulldocs */
202 /** A service resolver object */
203 typedef struct AvahiHostNameResolver AvahiHostNameResolver;
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,
212 const AvahiAddress *a,
213 AvahiLookupResultFlags flags,
216 /** Create a new hostname resolver object */
217 AvahiHostNameResolver * avahi_host_name_resolver_new(
219 AvahiIfIndex interface,
220 AvahiProtocol protocol,
222 AvahiProtocol aprotocol,
223 AvahiLookupFlags flags,
224 AvahiHostNameResolverCallback callback,
227 /** Get the parent client of an AvahiHostNameResolver object */
228 AvahiClient* avahi_host_name_resolver_get_client (AvahiHostNameResolver *);
230 /** Free a hostname resolver object */
231 int avahi_host_name_resolver_free(AvahiHostNameResolver *r);
233 /** An address resolver object */
234 typedef struct AvahiAddressResolver AvahiAddressResolver;
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,
244 AvahiLookupResultFlags flags,
247 /** Create a new address resolver object from an AvahiAddress object */
248 AvahiAddressResolver* avahi_address_resolver_new(
250 AvahiIfIndex interface,
251 AvahiProtocol protocol,
252 const AvahiAddress *a,
253 AvahiLookupFlags flags,
254 AvahiAddressResolverCallback callback,
257 /** Get the parent client of an AvahiAddressResolver object */
258 AvahiClient* avahi_address_resolver_get_client (AvahiAddressResolver *);
260 /** Free a AvahiAddressResolver resolver object */
261 int avahi_address_resolver_free(AvahiAddressResolver *r);
265 /** @{ \name Record Browser */
267 /** A record browser object */
268 typedef struct AvahiRecordBrowser AvahiRecordBrowser;
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,
281 AvahiLookupResultFlags flags,
284 /** Browse for records of a type on the local network */
285 AvahiRecordBrowser* avahi_record_browser_new(
287 AvahiIfIndex interface,
288 AvahiProtocol protocol,
292 AvahiLookupFlags flags,
293 AvahiRecordBrowserCallback callback,
296 /** Get the parent client of an AvahiRecordBrowser object */
297 AvahiClient* avahi_record_browser_get_client(AvahiRecordBrowser *);
299 /** Cleans up and frees an AvahiRecordBrowser object */
300 int avahi_record_browser_free(AvahiRecordBrowser *);