]> git.meshlink.io Git - catta/blob - avahi-core/core.h
* strip glib from avahi-core
[catta] / avahi-core / core.h
1 #ifndef foocorehfoo
2 #define foocorehfoo
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 /** \file core.h The Avahi Multicast DNS and DNS Service Discovery implmentation. */
26
27 /** \example publish-service.c Example how to register a DNS-SD
28  * service using an embedded mDNS stack. It behaves like a network
29  * printer registering both an IPP and a BSD LPR service. */
30
31 /** \example browse-services.c Example how to browse for DNS-SD
32  * services using an embedded mDNS stack. */
33
34 #include <avahi-common/cdecl.h>
35
36 #ifndef DOXYGEN_SHOULD_SKIP_THIS
37 AVAHI_C_DECL_BEGIN
38 #endif
39
40 /** An mDNS responder object */
41 typedef struct AvahiServer AvahiServer;
42
43 /** A locally registered DNS resource record */
44 typedef struct AvahiEntry AvahiEntry;
45
46 /** A group of locally registered DNS RRs */
47 typedef struct AvahiEntryGroup AvahiEntryGroup;
48
49 #ifndef DOXYGEN_SHOULD_SKIP_THIS
50 AVAHI_C_DECL_END
51 #endif
52
53 #include <avahi-core/rr.h>
54 #include <avahi-common/address.h>
55 #include <avahi-common/alternative.h>
56 #include <avahi-common/error.h>
57 #include <avahi-common/defs.h>
58 #include <avahi-common/watch.h>
59
60 #ifndef DOXYGEN_SHOULD_SKIP_THIS
61 AVAHI_C_DECL_BEGIN
62 #endif
63
64 /** Flags for server entries */
65 typedef enum {
66     AVAHI_ENTRY_NULL = 0,          /**< No special flags */
67     AVAHI_ENTRY_UNIQUE = 1,        /**< The RRset is intended to be unique */
68     AVAHI_ENTRY_NOPROBE = 2,       /**< Though the RRset is intended to be unique no probes shall be sent */
69     AVAHI_ENTRY_NOANNOUNCE = 4,    /**< Do not announce this RR to other hosts */
70     AVAHI_ENTRY_ALLOWMUTIPLE = 8   /**< Allow multiple local records of this type, even if they are intended to be unique */
71 } AvahiEntryFlags;
72
73 /** Prototype for callback functions which are called whenever the state of an AvahiServer object changes */
74 typedef void (*AvahiServerCallback) (AvahiServer *s, AvahiServerState state, void* userdata);
75
76 /** Prototype for callback functions which are called whenever the state of an AvahiEntryGroup object changes */
77 typedef void (*AvahiEntryGroupCallback) (AvahiServer *s, AvahiEntryGroup *g, AvahiEntryGroupState state, void* userdata);
78
79 /** Stores configuration options for a server instance */
80 typedef struct AvahiServerConfig {
81     char *host_name;                      /**< Default host name. If left empty defaults to the result of gethostname(2) of the libc */
82     char *domain_name;                    /**< Default domain name. If left empty defaults to .local */
83     int use_ipv4;                     /**< Enable IPv4 support */
84     int use_ipv6;                     /**< Enable IPv6 support */
85     int publish_hinfo;                /**< Register a HINFO record for the host containing the local OS and CPU type */
86     int publish_addresses;            /**< Register A, AAAA and PTR records for all local IP addresses */
87     int publish_workstation;          /**< Register a _workstation._tcp service */
88     int publish_domain;               /**< Announce the local domain for browsing */
89     int check_response_ttl;           /**< If enabled the server ignores all incoming responses with IP TTL != 255. Newer versions of the RFC do no longer contain this check, so it is disabled by default. */
90     int use_iff_running;              /**< Require IFF_RUNNING on local network interfaces. This is the official way to check for link beat. Unfortunately this doesn't work with all drivers. So bettere leave this off. */
91     int enable_reflector;             /**< Reflect incoming mDNS traffic to all local networks. This allows mDNS based network browsing beyond ethernet borders */
92     int reflect_ipv;                  /**< if enable_reflector is 1, enable/disable reflecting between IPv4 and IPv6 */
93 } AvahiServerConfig;
94
95 /** Allocate a new mDNS responder object. */
96 AvahiServer *avahi_server_new(
97     AvahiPoll *api,                /**< The main loop adapter */
98     const AvahiServerConfig *sc,   /**< If non-NULL a pointer to a configuration structure for the server. The server makes an internal deep copy of this structure, so you may free it using avahi_server_config_done() immediately after calling this function. */
99     AvahiServerCallback callback,  /**< A callback which is called whenever the state of the server changes */
100     void* userdata,                /**< An opaque pointer which is passed to the callback function */
101     int *error);
102
103 /** Free an mDNS responder object */
104 void avahi_server_free(AvahiServer* s);
105
106 /** Fill in default values for a server configuration structure. If you
107  * make use of an AvahiServerConfig structure be sure to initialize
108  * it with this function for the sake of upwards library
109  * compatibility. This call may allocate strings on the heap. To
110  * release this memory make sure to call
111  * avahi_server_config_done(). If you want to replace any strings in
112  * the structure be sure to free the strings filled in by this
113  * function with avahi_free() first and allocate the replacements with
114  * g_malloc() (or g_strdup()).*/
115 AvahiServerConfig* avahi_server_config_init(
116    AvahiServerConfig *c /**< A structure which shall be filled in */ );
117
118 /** Make a deep copy of the configuration structure *c to *ret. */
119 AvahiServerConfig* avahi_server_config_copy(
120     AvahiServerConfig *ret /**< destination */,
121     const AvahiServerConfig *c /**< source */);
122
123 /** Free the data in a server configuration structure. */
124 void avahi_server_config_free(AvahiServerConfig *c);
125
126 /** Return the currently chosen domain name of the server object. The
127  * return value points to an internally allocated string. Be sure to
128  * make a copy of the string before calling any other library
129  * functions. */
130 const char* avahi_server_get_domain_name(AvahiServer *s);
131
132 /** Return the currently chosen host name. The return value points to a internally allocated string. */
133 const char* avahi_server_get_host_name(AvahiServer *s);
134
135 /** Return the currently chosen host name as a FQDN ("fully qualified
136  * domain name", i.e. the concatenation of the host and domain
137  * name). The return value points to a internally allocated string. */
138 const char* avahi_server_get_host_name_fqdn(AvahiServer *s);
139
140 /** Change the host name of a running mDNS responder. This will drop
141 all automicatilly generated RRs and readd them with the new
142 name. Since the responder has to probe for the new RRs this function
143 takes some time to take effect altough it returns immediately. This
144 function is intended to be called when a host name conflict is
145 reported using AvahiServerCallback. The caller should readd all user
146 defined RRs too since they otherwise continue to point to the outdated
147 host name..*/
148 int avahi_server_set_host_name(AvahiServer *s, const char *host_name);
149
150 /** Change the domain name of a running mDNS responder. The same rules
151  * as with avahi_server_set_host_name() apply. */
152 int avahi_server_set_domain_name(AvahiServer *s, const char *domain_name);
153
154 /** Return the opaque user data pointer attached to a server object */
155 void* avahi_server_get_data(AvahiServer *s);
156
157 /** Change the opaque user data pointer attached to a server object */
158 void avahi_server_set_data(AvahiServer *s, void* userdata);
159
160 /** Return the current state of the server object */
161 AvahiServerState avahi_server_get_state(AvahiServer *s);
162
163 /** Iterate through all local entries of the server. (when g is NULL)
164  * or of a specified entry group. At the first call state should point
165  * to a NULL initialized void pointer, That pointer is used to track
166  * the current iteration. It is not safe to call any other
167  * avahi_server_xxx() function during the iteration. If the last entry
168  * has been read, NULL is returned. */
169 const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiEntryGroup *g, void **state);
170
171 /** Callback prototype for avahi_server_dump() */
172 typedef void (*AvahiDumpCallback)(const char *text, void* userdata);
173
174 /** Dump the current server status by calling "callback" for each line.  */
175 int avahi_server_dump(AvahiServer *s, AvahiDumpCallback callback, void* userdata);
176
177 /** Create a new entry group. The specified callback function is
178  * called whenever the state of the group changes. Use entry group
179  * objects to keep track of you RRs. Add new RRs to a group using
180  * avahi_server_add_xxx(). Make sure to call avahi_entry_group_commit()
181  * to start the registration process for your RRs */
182 AvahiEntryGroup *avahi_entry_group_new(AvahiServer *s, AvahiEntryGroupCallback callback, void* userdata);
183
184 /** Free an entry group. All RRs assigned to the group are removed from the server */
185 void avahi_entry_group_free(AvahiEntryGroup *g);
186
187 /** Commit an entry group. This starts the probing and registration process for all RRs in the group */
188 int avahi_entry_group_commit(AvahiEntryGroup *g);
189
190 /** Remove all entries from the entry group and reset the state to AVAHI_ENTRY_GROUP_UNCOMMITED. */
191 void avahi_entry_group_reset(AvahiEntryGroup *g);
192
193 /** Return 1 if the entry group is empty, i.e. has no records attached. */
194 int avahi_entry_group_is_empty(AvahiEntryGroup *g);
195
196 /** Return the current state of the specified entry group */
197 AvahiEntryGroupState avahi_entry_group_get_state(AvahiEntryGroup *g);
198
199 /** Change the opaque user data pointer attached to an entry group object */
200 void avahi_entry_group_set_data(AvahiEntryGroup *g, void* userdata);
201
202 /** Return the opaque user data pointer currently set for the entry group object */
203 void* avahi_entry_group_get_data(AvahiEntryGroup *g);
204
205 /** Add a new resource record to the server. Returns 0 on success, negative otherwise. */
206 int avahi_server_add(
207     AvahiServer *s,           /**< The server object to add this record to */
208     AvahiEntryGroup *g,       /**< An entry group object if this new record shall be attached to one, or NULL. If you plan to remove the record sometime later you a required to pass an entry group object here. */
209     AvahiIfIndex interface,   /**< A numeric index of a network interface to attach this record to, or AVAHI_IF_UNSPEC to attach this record to all interfaces */
210     AvahiProtocol protocol,   /**< A protocol family to attach this record to. One of the AVAHI_PROTO_xxx constants. Use AVAHI_PROTO_UNSPEC to make this record available on all protocols (wich means on both IPv4 and IPv6). */
211     AvahiEntryFlags flags,    /**< Special flags for this record */
212     AvahiRecord *r            /**< The record to add. This function increases the reference counter of this object. */   );
213
214 /** Add a PTR RR to the server. See avahi_server_add() for more information. */
215 int avahi_server_add_ptr(
216     AvahiServer *s,
217     AvahiEntryGroup *g,
218     AvahiIfIndex interface,
219     AvahiProtocol protocol,
220     AvahiEntryFlags flags,
221     uint32_t ttl,             /**< DNS TTL for this record */
222     const char *name,       /**< PTR record name */
223     const char *dest        /**< pointer destination */  );
224
225 /** Add a PTR RR to the server. See avahi_server_add() for more information. */
226 int avahi_server_add_txt(
227     AvahiServer *s,
228     AvahiEntryGroup *g,
229     AvahiIfIndex interface,
230     AvahiProtocol protocol,
231     AvahiEntryFlags flags,
232     uint32_t ttl,             /**< DNS TTL for this record */
233     const char *name,       /**< TXT record name */
234     ... /**< Text record data, terminated by NULL */);
235
236 /** Add a PTR RR to the server. Mostly identical to
237  * avahi_server_add_text but takes a va_list instead of a variable
238  * number of arguments */
239 int avahi_server_add_txt_va(
240     AvahiServer *s,
241     AvahiEntryGroup *g,
242     AvahiIfIndex interface,
243     AvahiProtocol protocol,
244     AvahiEntryFlags flags,
245     uint32_t ttl,
246     const char *name,
247     va_list va);
248
249 /** Add a PTR RR to the server. Mostly identical to 
250  * avahi_server_add_text but takes an AvahiStringList record instead of a variable
251  * number of arguments. */
252 int avahi_server_add_txt_strlst(
253     AvahiServer *s,
254     AvahiEntryGroup *g,
255     AvahiIfIndex interface,
256     AvahiProtocol protocol,
257     AvahiEntryFlags flags,
258     uint32_t ttl,
259     const char *name,
260     AvahiStringList *strlst  /**< TXT decord data as a AvahiString. This routine makes a deep copy of this object. */ );
261
262 /** Add an IP address mapping to the server. This will add both the
263  * host-name-to-address and the reverse mapping to the server. See
264  * avahi_server_add() for more information. If adding one of the RRs
265  * fails, the function returns with an error, but it is not defined if
266  * the other RR is deleted from the server or not. Therefore, you have
267  * to free the AvahiEntryGroup and create a new one before
268  * proceeding. */
269 int avahi_server_add_address(
270     AvahiServer *s,
271     AvahiEntryGroup *g,
272     AvahiIfIndex interface,
273     AvahiProtocol protocol,
274     AvahiEntryFlags flags,
275     const char *name,
276     AvahiAddress *a);
277
278 /** Add an DNS-SD service to the Server. This will add all required
279  * RRs to the server. See avahi_server_add() for more information.  If
280  * adding one of the RRs fails, the function returns with an error,
281  * but it is not defined if the other RR is deleted from the server or
282  * not. Therefore, you have to free the AvahiEntryGroup and create a
283  * new one before proceeding. */
284 int avahi_server_add_service(
285     AvahiServer *s,
286     AvahiEntryGroup *g,
287     AvahiIfIndex interface,
288     AvahiProtocol protocol,
289     const char *name,         /**< Service name, e.g. "Lennart's Files" */
290     const char *type,         /**< DNS-SD type, e.g. "_http._tcp" */
291     const char *domain,       
292     const char *host,         /**< Host name where this servcie resides, or NULL if on the local host */
293     uint16_t port,              /**< Port number of the service */
294     ...  /**< Text records, terminated by NULL */);
295
296 /** Mostly identical to avahi_server_add_service(), but takes an va_list for the TXT records. */
297 int avahi_server_add_service_va(
298     AvahiServer *s,
299     AvahiEntryGroup *g,
300     AvahiIfIndex interface,
301     AvahiProtocol protocol,
302     const char *name,
303     const char *type,
304     const char *domain,
305     const char *host,
306     uint16_t port,
307     va_list va);
308
309 /** Mostly identical to avahi_server_add_service(), but takes an AvahiStringList object for the TXT records.  The AvahiStringList object is copied. */
310 int avahi_server_add_service_strlst(
311     AvahiServer *s,
312     AvahiEntryGroup *g,
313     AvahiIfIndex interface,
314     AvahiProtocol protocol,
315     const char *name,
316     const char *type,
317     const char *domain,
318     const char *host,
319     uint16_t port,
320     AvahiStringList *strlst);
321
322 /** The type of DNS server */
323 typedef enum {
324     AVAHI_DNS_SERVER_RESOLVE,         /**< Unicast DNS servers for normal resolves (_domain._udp)*/
325     AVAHI_DNS_SERVER_UPDATE           /**< Unicast DNS servers for updates (_dns-update._udp)*/
326 } AvahiDNSServerType;
327
328 /** Publish the specified unicast DNS server address via mDNS. You may
329  * browse for records create this way wit
330  * avahi_dns_server_browser_new(). */
331 int avahi_server_add_dns_server_address(
332     AvahiServer *s,
333     AvahiEntryGroup *g,
334     AvahiIfIndex interface,
335     AvahiProtocol protocol,
336     const char *domain,
337     AvahiDNSServerType type,
338     const AvahiAddress *address,
339     uint16_t port /** should be 53 */);
340
341 /** Similar to avahi_server_add_dns_server_address(), but specify a
342 host name instead of an address. The specified host name should be
343 resolvable via mDNS */
344 int avahi_server_add_dns_server_name(
345     AvahiServer *s,
346     AvahiEntryGroup *g,
347     AvahiIfIndex interface,
348     AvahiProtocol protocol,
349     const char *domain,
350     AvahiDNSServerType type,
351     const char *name,
352     uint16_t port /** should be 53 */);
353
354 /** A browsing object for arbitrary RRs */
355 typedef struct AvahiRecordBrowser AvahiRecordBrowser;
356
357 /** Callback prototype for AvahiRecordBrowser events */
358 typedef void (*AvahiRecordBrowserCallback)(
359     AvahiRecordBrowser *b,       /**< The AvahiRecordBrowser object that is emitting this callback */
360     AvahiIfIndex interface,      /**< Logical OS network interface number the record was found on */
361     AvahiProtocol protocol,      /**< Protocol number the record was found. */
362     AvahiBrowserEvent event,     /**< Browsing event, either AVAHI_BROWSER_NEW or AVAHI_BROWSER_REMOVE */
363     AvahiRecord *record,         /**< The record that was found */
364     void* userdata            /**< Arbitrary user data passed to avahi_record_browser_new() */ );
365
366 /** Create a new browsing object for arbitrary RRs */
367 AvahiRecordBrowser *avahi_record_browser_new(
368     AvahiServer *server,                  /**< The server object to which attach this query */
369     AvahiIfIndex interface,               /**< Logical OS interface number where to look for the records, or AVAHI_IF_UNSPEC to look on interfaces */
370     AvahiProtocol protocol,               /**< Protocol number to use when looking for the record, or AVAHI_PROTO_UNSPEC to look on all protocols */
371     AvahiKey *key,                        /**< The search key */
372     AvahiRecordBrowserCallback callback,  /**< The callback to call on browsing events */
373     void* userdata                     /**< Arbitrary use suppliable data which is passed to the callback */);
374
375 /** Free an AvahiRecordBrowser object */
376 void avahi_record_browser_free(AvahiRecordBrowser *b);
377
378 /** A host name to IP adddress resolver object */
379 typedef struct AvahiHostNameResolver AvahiHostNameResolver;
380
381 /** Callback prototype for AvahiHostNameResolver events */
382 typedef void (*AvahiHostNameResolverCallback)(
383     AvahiHostNameResolver *r,
384     AvahiIfIndex interface,  
385     AvahiProtocol protocol,
386     AvahiResolverEvent event, /**< Resolving event */
387     const char *host_name,   /**< Host name which should be resolved. May differ in case from the query */
388     const AvahiAddress *a,    /**< The address, or NULL if the host name couldn't be resolved. */
389     void* userdata);
390
391 /** Create an AvahiHostNameResolver object for resolving a host name to an adddress. See AvahiRecordBrowser for more info on the paramters. */
392 AvahiHostNameResolver *avahi_host_name_resolver_new(
393     AvahiServer *server,
394     AvahiIfIndex interface,
395     AvahiProtocol protocol,
396     const char *host_name,    /**< The host name to look for */
397     AvahiProtocol aprotocol,   /**< The address family of the desired address or AVAHI_PROTO_UNSPEC if doesn't matter. */
398     AvahiHostNameResolverCallback calback,
399     void* userdata);
400
401 /** Free a AvahiHostNameResolver object */
402 void avahi_host_name_resolver_free(AvahiHostNameResolver *r);
403
404 /** An IP address to host name resolver object ("reverse lookup") */
405 typedef struct AvahiAddressResolver AvahiAddressResolver;
406
407 /** Callback prototype for AvahiAddressResolver events */
408 typedef void (*AvahiAddressResolverCallback)(
409     AvahiAddressResolver *r,
410     AvahiIfIndex interface,
411     AvahiProtocol protocol,
412     AvahiResolverEvent event,
413     const AvahiAddress *a,   
414     const char *host_name,   /**< A host name for the specified address, if one was found, i.e. event == AVAHI_RESOLVER_FOUND */
415     void* userdata);
416
417 /** Create an AvahiAddressResolver object. See AvahiRecordBrowser for more info on the paramters. */
418 AvahiAddressResolver *avahi_address_resolver_new(
419     AvahiServer *server,
420     AvahiIfIndex interface,
421     AvahiProtocol protocol,
422     const AvahiAddress *address,
423     AvahiAddressResolverCallback calback,
424     void* userdata);
425
426 /** Free an AvahiAddressResolver object */
427 void avahi_address_resolver_free(AvahiAddressResolver *r);
428
429 /** A local domain browsing object. May be used to enumerate domains used on the local LAN */
430 typedef struct AvahiDomainBrowser AvahiDomainBrowser;
431
432 /** Callback prototype for AvahiDomainBrowser events */
433 typedef void (*AvahiDomainBrowserCallback)(
434     AvahiDomainBrowser *b,
435     AvahiIfIndex interface,
436     AvahiProtocol protocol,
437     AvahiBrowserEvent event,
438     const char *domain,
439     void* userdata);
440
441 /** Create a new AvahiDomainBrowser object */
442 AvahiDomainBrowser *avahi_domain_browser_new(
443     AvahiServer *server,
444     AvahiIfIndex interface,
445     AvahiProtocol protocol,
446     const char *domain,
447     AvahiDomainBrowserType type,
448     AvahiDomainBrowserCallback callback,
449     void* userdata);
450
451 /** Free an AvahiDomainBrowser object */
452 void avahi_domain_browser_free(AvahiDomainBrowser *b);
453
454 /** A DNS-SD service type browsing object. May be used to enumerate the service types of all available services on the local LAN */
455 typedef struct AvahiServiceTypeBrowser AvahiServiceTypeBrowser;
456
457 /** Callback prototype for AvahiServiceTypeBrowser events */
458 typedef void (*AvahiServiceTypeBrowserCallback)(
459     AvahiServiceTypeBrowser *b,
460     AvahiIfIndex interface,
461     AvahiProtocol protocol,
462     AvahiBrowserEvent event,
463     const char *type,
464     const char *domain,
465     void* userdata);
466
467 /** Create a new AvahiServiceTypeBrowser object. */
468 AvahiServiceTypeBrowser *avahi_service_type_browser_new(
469     AvahiServer *server,
470     AvahiIfIndex interface,
471     AvahiProtocol protocol,
472     const char *domain,
473     AvahiServiceTypeBrowserCallback callback,
474     void* userdata);
475
476 /** Free an AvahiServiceTypeBrowser object */
477 void avahi_service_type_browser_free(AvahiServiceTypeBrowser *b);
478
479 /** A DNS-SD service browser. Use this to enumerate available services of a certain kind on the local LAN. Use AvahiServiceResolver to get specific service data like address and port for a service. */
480 typedef struct AvahiServiceBrowser AvahiServiceBrowser;
481
482 /** Callback prototype for AvahiServiceBrowser events */
483 typedef void (*AvahiServiceBrowserCallback)(
484     AvahiServiceBrowser *b,
485     AvahiIfIndex interface,
486     AvahiProtocol protocol,
487     AvahiBrowserEvent event,
488     const char *name     /**< Service name, e.g. "Lennart's Files" */,
489     const char *type     /**< DNS-SD type, e.g. "_http._tcp" */,
490     const char *domain   /**< Domain of this service, e.g. "local" */,
491     void* userdata);
492
493 /** Create a new AvahiServiceBrowser object. */
494 AvahiServiceBrowser *avahi_service_browser_new(
495     AvahiServer *server,
496     AvahiIfIndex interface,
497     AvahiProtocol protocol,
498     const char *service_type /** DNS-SD service type, e.g. "_http._tcp" */,
499     const char *domain,
500     AvahiServiceBrowserCallback callback,
501     void* userdata);
502
503 /** Free an AvahiServiceBrowser object */
504 void avahi_service_browser_free(AvahiServiceBrowser *b);
505
506 /** A DNS-SD service resolver.  Use this to retrieve addres, port and TXT data for a DNS-SD service */
507 typedef struct AvahiServiceResolver AvahiServiceResolver;
508
509 /** Callback prototype for AvahiServiceResolver events */
510 typedef void (*AvahiServiceResolverCallback)(
511     AvahiServiceResolver *r,
512     AvahiIfIndex interface,
513     AvahiProtocol protocol,
514     AvahiResolverEvent event,
515     const char *name,       /**< Service name */
516     const char *type,       /**< Service Type */
517     const char *domain,
518     const char *host_name,  /**< Host name of the service */
519     const AvahiAddress *a,   /**< The resolved host name */
520     uint16_t port,            /**< Service name */
521     AvahiStringList *txt,    /**< TXT record data */
522     void* userdata);
523
524 /** Create a new AvahiServiceResolver object */
525 AvahiServiceResolver *avahi_service_resolver_new(
526     AvahiServer *server,
527     AvahiIfIndex interface,
528     AvahiProtocol protocol,
529     const char *name,
530     const char *type,
531     const char *domain,
532     AvahiProtocol aprotocol,    /**< Address family of the desired service address. Use AVAHI_PROTO_UNSPEC if you don't care */
533     AvahiServiceResolverCallback calback,
534     void* userdata);
535
536 /** Free an AvahiServiceResolver object */
537 void avahi_service_resolver_free(AvahiServiceResolver *r);
538
539 /** A domain service browser object. Use this to browse for
540  * conventional unicast DNS servers which may be used to resolve
541  * conventional domain names */
542 typedef struct AvahiDNSServerBrowser AvahiDNSServerBrowser;
543
544 /** Callback prototype for AvahiDNSServerBrowser events */
545 typedef void (*AvahiDNSServerBrowserCallback)(
546     AvahiDNSServerBrowser *b,
547     AvahiIfIndex interface,
548     AvahiProtocol protocol,
549     AvahiBrowserEvent event,
550     const char *host_name,       /**< Host name of the DNS server, probably useless */
551     const AvahiAddress *a,        /**< Address of the DNS server */
552     uint16_t port,                 /**< Port number of the DNS servers, probably 53 */
553     void* userdata);
554
555 /** Create a new AvahiDNSServerBrowser object */
556 AvahiDNSServerBrowser *avahi_dns_server_browser_new(
557     AvahiServer *server,
558     AvahiIfIndex interface,
559     AvahiProtocol protocol,
560     const char *domain,
561     AvahiDNSServerType type,
562     AvahiProtocol aprotocol,  /**< Address protocol for the DNS server */ 
563     AvahiDNSServerBrowserCallback callback,
564     void* userdata);
565
566 /** Free an AvahiDNSServerBrowser object */
567 void avahi_dns_server_browser_free(AvahiDNSServerBrowser *b);
568
569 /** Return the last error code */
570 int avahi_server_errno(AvahiServer *s);
571
572 #ifndef DOXYGEN_SHOULD_SKIP_THIS
573 AVAHI_C_DECL_END
574 #endif
575
576 #endif