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