]> git.meshlink.io Git - catta/blob - avahi-core/core.h
remove stdio.h inclusion from core.h
[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 #include <glib.h>
26
27 /** \file core.h The Avahi Multicast DNS and DNS Service Discovery implmentation. */
28
29 #include <avahi-common/cdecl.h>
30
31 AVAHI_C_DECL_BEGIN
32
33 /** An mDNS responder object */
34 typedef struct AvahiServer AvahiServer;
35
36 /** A locally registered DNS resource record */
37 typedef struct AvahiEntry AvahiEntry;
38
39 /** A group of locally registered DNS RRs */
40 typedef struct AvahiEntryGroup AvahiEntryGroup;
41
42 AVAHI_C_DECL_END
43
44 #include <avahi-common/address.h>
45 #include <avahi-common/rr.h>
46 #include <avahi-common/alternative.h>
47
48 AVAHI_C_DECL_BEGIN
49
50 /** States of a server object */
51 typedef enum {
52     AVAHI_SERVER_INVALID = -1,     /**< Invalid state (initial) */ 
53     AVAHI_SERVER_REGISTERING = 0,  /**< Host RRs are being registered */
54     AVAHI_SERVER_RUNNING,          /**< All host RRs have been established */
55     AVAHI_SERVER_COLLISION,        /**< There is a collision with a host RR. All host RRs have been withdrawn, the user should set a new host name via avahi_server_set_host_name() */
56     AVAHI_SERVER_SLEEPING          /**< The host or domain name has changed and the server waits for old entries to be expired */
57 } AvahiServerState;
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 /** States of an entry group object */
69 typedef enum {
70     AVAHI_ENTRY_GROUP_UNCOMMITED = -1,   /**< The group has not yet been commited, the user must still call avahi_entry_group_commit() */
71     AVAHI_ENTRY_GROUP_REGISTERING = 0,   /**< The entries of the group are currently being registered */
72     AVAHI_ENTRY_GROUP_ESTABLISHED,       /**< The entries have successfully been established */
73     AVAHI_ENTRY_GROUP_COLLISION          /**< A name collision for one of the entries in the group has been detected, the entries have been withdrawn */ 
74 } AvahiEntryGroupState;
75
76 /** Prototype for callback functions which are called whenever the state of an AvahiServer object changes */
77 typedef void (*AvahiServerCallback) (AvahiServer *s, AvahiServerState state, gpointer userdata);
78
79 /** Prototype for callback functions which are called whenever the state of an AvahiEntryGroup object changes */
80 typedef void (*AvahiEntryGroupCallback) (AvahiServer *s, AvahiEntryGroup *g, AvahiEntryGroupState state, gpointer userdata);
81
82 /** Stores configuration options for a server instance */
83 typedef struct AvahiServerConfig {
84     gchar *host_name;                      /**< Default host name. If left empty defaults to the result of gethostname(2) of the libc */
85     gchar *domain_name;                    /**< Default domain name. If left empty defaults to .local */
86     gboolean use_ipv4;                     /**< Enable IPv4 support */
87     gboolean use_ipv6;                     /**< Enable IPv6 support */
88     gboolean publish_hinfo;                /**< Register a HINFO record for the host containing the local OS and CPU type */
89     gboolean publish_addresses;            /**< Register A, AAAA and PTR records for all local IP addresses */
90     gboolean publish_workstation;          /**< Register a _workstation._tcp service */
91     gboolean publish_domain;               /**< Announce the local domain for browsing */
92     gboolean 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. */
93     gboolean 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. */
94     gboolean enable_reflector;             /**< Reflect incoming mDNS traffic to all local networks. This allows mDNS based network browsing beyond ethernet borders */
95     gboolean reflect_ipv;                  /**< if enable_reflector is TRUE, enable/disable reflecting between IPv4 and IPv6 */
96 } AvahiServerConfig;
97
98 /** Allocate a new mDNS responder object. */
99 AvahiServer *avahi_server_new(
100     GMainContext *c,               /**< The GLIB main loop context to attach to */
101     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. */
102     AvahiServerCallback callback,  /**< A callback which is called whenever the state of the server changes */
103     gpointer userdata              /**< An opaque pointer which is passed to the callback function */);
104
105 /** Free an mDNS responder object */
106 void avahi_server_free(AvahiServer* s);
107
108 /** Fill in default values for a server configuration structure. If you
109  * make use of an AvahiServerConfig structure be sure to initialize
110  * it with this function for the sake of upwards library
111  * compatibility. This call may allocate strings on the heap. To
112  * release this memory make sure to call
113  * avahi_server_config_done(). If you want to replace any strings in
114  * the structure be sure to free the strings filled in by this
115  * function with g_free() first and allocate the replacements with
116  * g_malloc() (or g_strdup()).*/
117 AvahiServerConfig* avahi_server_config_init(
118    AvahiServerConfig *c /**< A structure which shall be filled in */ );
119
120 /** Make a deep copy of the configuration structure *c to *ret. */
121 AvahiServerConfig* avahi_server_config_copy(
122     AvahiServerConfig *ret /**< destination */,
123     const AvahiServerConfig *c /**< source */);
124
125 /** Free the data in a server configuration structure. */
126 void avahi_server_config_free(AvahiServerConfig *c);
127
128 /** Return the currently chosen domain name of the server object. The
129  * return value points to an internally allocated string. Be sure to
130  * make a copy of the string before calling any other library
131  * functions. */
132 const gchar* avahi_server_get_domain_name(AvahiServer *s);
133
134 /** Return the currently chosen host name. The return value points to a internally allocated string. */
135 const gchar* avahi_server_get_host_name(AvahiServer *s);
136
137 /** Return the currently chosen host name as a FQDN ("fully qualified
138  * domain name", i.e. the concatenation of the host and domain
139  * name). The return value points to a internally allocated string. */
140 const gchar* avahi_server_get_host_name_fqdn(AvahiServer *s);
141
142 /** Change the host name of a running mDNS responder. This will drop
143 all automicatilly generated RRs and readd them with the new
144 name. Since the responder has to probe for the new RRs this function
145 takes some time to take effect altough it returns immediately. This
146 function is intended to be called when a host name conflict is
147 reported using AvahiServerCallback. The caller should readd all user
148 defined RRs too since they otherwise continue to point to the outdated
149 host name..*/
150 gint avahi_server_set_host_name(AvahiServer *s, const gchar *host_name);
151
152 /** Change the domain name of a running mDNS responder. The same rules
153  * as with avahi_server_set_host_name() apply. */
154 gint avahi_server_set_domain_name(AvahiServer *s, const gchar *domain_name);
155
156 /** Return the opaque user data pointer attached to a server object */
157 gpointer avahi_server_get_data(AvahiServer *s);
158
159 /** Change the opaque user data pointer attached to a server object */
160 void avahi_server_set_data(AvahiServer *s, gpointer userdata);
161
162 /** Return the current state of the server object */
163 AvahiServerState avahi_server_get_state(AvahiServer *s);
164
165 /** Iterate through all local entries of the server. (when g is NULL)
166  * or of a specified entry group. At the first call state should point
167  * to a NULL initialized void pointer, That pointer is used to track
168  * the current iteration. It is not safe to call any other
169  * avahi_server_xxx() function during the iteration. If the last entry
170  * has been read, NULL is returned. */
171 const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiEntryGroup *g, void **state);
172
173 /** Callback prototype for avahi_server_dump() */
174 typedef void (*AvahiDumpCallback)(const gchar *text, gpointer userdata);
175
176 /** Dump the current server status by calling "callback" for each line.  */
177 void avahi_server_dump(AvahiServer *s, AvahiDumpCallback callback, gpointer userdata);
178
179 /** Create a new entry group. The specified callback function is
180  * called whenever the state of the group changes. Use entry group
181  * objects to keep track of you RRs. Add new RRs to a group using
182  * avahi_server_add_xxx(). Make sure to call avahi_entry_group_commit()
183  * to start the registration process for your RRs */
184 AvahiEntryGroup *avahi_entry_group_new(AvahiServer *s, AvahiEntryGroupCallback callback, gpointer userdata);
185
186 /** Free an entry group. All RRs assigned to the group are removed from the server */
187 void avahi_entry_group_free(AvahiEntryGroup *g);
188
189 /** Commit an entry group. This starts the probing and registration process for all RRs in the group */
190 gint avahi_entry_group_commit(AvahiEntryGroup *g);
191
192 /** Return the current state of the specified entry group */
193 AvahiEntryGroupState avahi_entry_group_get_state(AvahiEntryGroup *g);
194
195 /** Change the opaque user data pointer attached to an entry group object */
196 void avahi_entry_group_set_data(AvahiEntryGroup *g, gpointer userdata);
197
198 /** Return the opaque user data pointer currently set for the entry group object */
199 gpointer avahi_entry_group_get_data(AvahiEntryGroup *g);
200
201 /** Add a new resource record to the server. Returns 0 on success, negative otherwise. */
202 gint avahi_server_add(
203     AvahiServer *s,           /**< The server object to add this record to */
204     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. */
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 gint avahi_server_add_ptr(
212     AvahiServer *s,
213     AvahiEntryGroup *g,
214     AvahiIfIndex interface,
215     AvahiProtocol protocol,
216     AvahiEntryFlags flags,
217     guint32 ttl,             /**< DNS TTL for this record */
218     const gchar *name,       /**< PTR record name */
219     const gchar *dest        /**< pointer destination */  );
220
221 /** Add a PTR RR to the server. See avahi_server_add() for more information. */
222 gint avahi_server_add_txt(
223     AvahiServer *s,
224     AvahiEntryGroup *g,
225     AvahiIfIndex interface,
226     AvahiProtocol protocol,
227     AvahiEntryFlags flags,
228     guint32 ttl,             /**< DNS TTL for this record */
229     const gchar *name,       /**< TXT record name */
230     ... /**< Text record data, terminated by NULL */);
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 gint avahi_server_add_txt_va(
236     AvahiServer *s,
237     AvahiEntryGroup *g,
238     AvahiIfIndex interface,
239     AvahiProtocol protocol,
240     AvahiEntryFlags flags,
241     guint32 ttl,
242     const gchar *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 gint avahi_server_add_txt_strlst(
249     AvahiServer *s,
250     AvahiEntryGroup *g,
251     AvahiIfIndex interface,
252     AvahiProtocol protocol,
253     AvahiEntryFlags flags,
254     guint32 ttl,
255     const gchar *name,
256     AvahiStringList *strlst  /**< TXT decord data as a AvahiString. Only the pointer to the object and not the object itself is copied into the RR. Therefore you should not free the strlst object yourself, this will be done by the library. If you want to add multiple records with the same RR data you MUST copy the strlst object prior to calling this function with avahi_strlst_copy(). */ );
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 AvahiEntryGroup and create a new one before
264  * proceeding. */
265 gint avahi_server_add_address(
266     AvahiServer *s,
267     AvahiEntryGroup *g,
268     AvahiIfIndex interface,
269     AvahiProtocol protocol,
270     AvahiEntryFlags flags,
271     const gchar *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 AvahiEntryGroup and create a
279  * new one before proceeding. */
280 gint avahi_server_add_service(
281     AvahiServer *s,
282     AvahiEntryGroup *g,
283     AvahiIfIndex interface,
284     AvahiProtocol protocol,
285     const gchar *name,         /**< Service name, e.g. "Lennart's Files" */
286     const gchar *type,         /**< DNS-SD type, e.g. "_http._tcp" */
287     const gchar *domain,       
288     const gchar *host,         /**< Host name where this servcie resides, or NULL if on the local host */
289     guint16 port,              /**< Port number of the service */
290     ...  /**< Text records, terminated by NULL */);
291
292 /** Mostly identical to avahi_server_add_service(), but takes an va_list for the TXT records. */
293 gint avahi_server_add_service_va(
294     AvahiServer *s,
295     AvahiEntryGroup *g,
296     AvahiIfIndex interface,
297     AvahiProtocol protocol,
298     const gchar *name,
299     const gchar *type,
300     const gchar *domain,
301     const gchar *host,
302     guint16 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 not copied. You need to make a copy if this object if you want to reuse it. The object is freed if the RR is removed from the server. */
306 gint avahi_server_add_service_strlst(
307     AvahiServer *s,
308     AvahiEntryGroup *g,
309     AvahiIfIndex interface,
310     AvahiProtocol protocol,
311     const gchar *name,
312     const gchar *type,
313     const gchar *domain,
314     const gchar *host,
315     guint16 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_dns_server_browser_new(). */
327 gint avahi_server_add_dns_server_address(
328     AvahiServer *s,
329     AvahiEntryGroup *g,
330     AvahiIfIndex interface,
331     AvahiProtocol protocol,
332     const gchar *domain,
333     AvahiDNSServerType type,
334     const AvahiAddress *address,
335     guint16 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 gint avahi_server_add_dns_server_name(
341     AvahiServer *s,
342     AvahiEntryGroup *g,
343     AvahiIfIndex interface,
344     AvahiProtocol protocol,
345     const gchar *domain,
346     AvahiDNSServerType type,
347     const gchar *name,
348     guint16 port /** should be 53 */);
349
350 /** Type of callback event when browsing */
351 typedef enum {
352     AVAHI_BROWSER_NEW = 0,            /**< The object is new on the network */
353     AVAHI_BROWSER_REMOVE = -1         /**< The object has been removed from the network */
354 } AvahiBrowserEvent;
355
356 /** Type of callback event when resolving */
357 typedef enum {
358     AVAHI_RESOLVER_FOUND = 0,         /**< RR found, resolving successful */
359     AVAHI_RESOLVER_TIMEOUT = -1       /**< Noone responded within the timeout, resolving failed */
360 } AvahiResolverEvent;
361
362 /** A browsing object for arbitrary RRs */
363 typedef struct AvahiRecordBrowser AvahiRecordBrowser;
364
365 /** Callback prototype for AvahiRecordBrowser events */
366 typedef void (*AvahiRecordBrowserCallback)(
367     AvahiRecordBrowser *b,       /**< The AvahiRecordBrowser object that is emitting this callback */
368     AvahiIfIndex interface,      /**< Logical OS network interface number the record was found on */
369     AvahiProtocol protocol,      /**< Protocol number the record was found. */
370     AvahiBrowserEvent event,     /**< Browsing event, either AVAHI_BROWSER_NEW or AVAHI_BROWSER_REMOVE */
371     AvahiRecord *record,         /**< The record that was found */
372     gpointer userdata            /**< Arbitrary user data passed to avahi_record_browser_new() */ );
373
374 /** Create a new browsing object for arbitrary RRs */
375 AvahiRecordBrowser *avahi_record_browser_new(
376     AvahiServer *server,                  /**< The server object to which attach this query */
377     AvahiIfIndex interface,               /**< Logical OS interface number where to look for the records, or AVAHI_IF_UNSPEC to look on interfaces */
378     AvahiProtocol protocol,               /**< Protocol number to use when looking for the record, or AVAHI_PROTO_UNSPEC to look on all protocols */
379     AvahiKey *key,                        /**< The search key */
380     AvahiRecordBrowserCallback callback,  /**< The callback to call on browsing events */
381     gpointer userdata                     /**< Arbitrary use suppliable data which is passed to the callback */);
382
383 /** Free an AvahiRecordBrowser object */
384 void avahi_record_browser_free(AvahiRecordBrowser *b);
385
386 /** A host name to IP adddress resolver object */
387 typedef struct AvahiHostNameResolver AvahiHostNameResolver;
388
389 /** Callback prototype for AvahiHostNameResolver events */
390 typedef void (*AvahiHostNameResolverCallback)(
391     AvahiHostNameResolver *r,
392     AvahiIfIndex interface,  
393     AvahiProtocol protocol,
394     AvahiResolverEvent event, /**< Resolving event */
395     const gchar *host_name,   /**< Host name which should be resolved. May differ in case from the query */
396     const AvahiAddress *a,    /**< The address, or NULL if the host name couldn't be resolved. */
397     gpointer userdata);
398
399 /** Create an AvahiHostNameResolver object for resolving a host name to an adddress. See AvahiRecordBrowser for more info on the paramters. */
400 AvahiHostNameResolver *avahi_host_name_resolver_new(
401     AvahiServer *server,
402     AvahiIfIndex interface,
403     AvahiProtocol protocol,
404     const gchar *host_name,    /**< The host name to look for */
405     AvahiProtocol aprotocol,   /**< The address family of the desired address or AVAHI_PROTO_UNSPEC if doesn't matter. */
406     AvahiHostNameResolverCallback calback,
407     gpointer userdata);
408
409 /** Free a AvahiHostNameResolver object */
410 void avahi_host_name_resolver_free(AvahiHostNameResolver *r);
411
412 /** An IP address to host name resolver object ("reverse lookup") */
413 typedef struct AvahiAddressResolver AvahiAddressResolver;
414
415 /** Callback prototype for AvahiAddressResolver events */
416 typedef void (*AvahiAddressResolverCallback)(
417     AvahiAddressResolver *r,
418     AvahiIfIndex interface,
419     AvahiProtocol protocol,
420     AvahiResolverEvent event,
421     const AvahiAddress *a,   
422     const gchar *host_name,   /**< A host name for the specified address, if one was found, i.e. event == AVAHI_RESOLVER_FOUND */
423     gpointer userdata);
424
425 /** Create an AvahiAddressResolver object. See AvahiRecordBrowser for more info on the paramters. */
426 AvahiAddressResolver *avahi_address_resolver_new(
427     AvahiServer *server,
428     AvahiIfIndex interface,
429     AvahiProtocol protocol,
430     const AvahiAddress *address,
431     AvahiAddressResolverCallback calback,
432     gpointer userdata);
433
434 /** Free an AvahiAddressResolver object */
435 void avahi_address_resolver_free(AvahiAddressResolver *r);
436
437 /** The type of domain to browse for */
438 typedef enum {
439     AVAHI_DOMAIN_BROWSER_REGISTER,          /**< Browse for a list of available registering domains */
440     AVAHI_DOMAIN_BROWSER_REGISTER_DEFAULT,  /**< Browse for the default registering domain */
441     AVAHI_DOMAIN_BROWSER_BROWSE,            /**< Browse for a list of available browsing domains */
442     AVAHI_DOMAIN_BROWSER_BROWSE_DEFAULT,    /**< Browse for the default browsing domain */
443     AVAHI_DOMAIN_BROWSER_BROWSE_LEGACY,     /**< Legacy browse domain - see DNS-SD spec for more information */
444     AVAHI_DOMAIN_BROWSER_MAX
445 } AvahiDomainBrowserType;
446
447 /** A local domain browsing object. May be used to enumerate domains used on the local LAN */
448 typedef struct AvahiDomainBrowser AvahiDomainBrowser;
449
450 /** Callback prototype for AvahiDomainBrowser events */
451 typedef void (*AvahiDomainBrowserCallback)(
452     AvahiDomainBrowser *b,
453     AvahiIfIndex interface,
454     AvahiProtocol protocol,
455     AvahiBrowserEvent event,
456     const gchar *domain,
457     gpointer userdata);
458
459 /** Create a new AvahiDomainBrowser object */
460 AvahiDomainBrowser *avahi_domain_browser_new(
461     AvahiServer *server,
462     AvahiIfIndex interface,
463     AvahiProtocol protocol,
464     const gchar *domain,
465     AvahiDomainBrowserType type,
466     AvahiDomainBrowserCallback callback,
467     gpointer userdata);
468
469 /** Free an AvahiDomainBrowser object */
470 void avahi_domain_browser_free(AvahiDomainBrowser *b);
471
472 /** A DNS-SD service type browsing object. May be used to enumerate the service types of all available services on the local LAN */
473 typedef struct AvahiServiceTypeBrowser AvahiServiceTypeBrowser;
474
475 /** Callback prototype for AvahiServiceTypeBrowser events */
476 typedef void (*AvahiServiceTypeBrowserCallback)(
477     AvahiServiceTypeBrowser *b,
478     AvahiIfIndex interface,
479     AvahiProtocol protocol,
480     AvahiBrowserEvent event,
481     const gchar *type,
482     const gchar *domain,
483     gpointer userdata);
484
485 /** Create a new AvahiServiceTypeBrowser object. */
486 AvahiServiceTypeBrowser *avahi_service_type_browser_new(
487     AvahiServer *server,
488     AvahiIfIndex interface,
489     AvahiProtocol protocol,
490     const gchar *domain,
491     AvahiServiceTypeBrowserCallback callback,
492     gpointer userdata);
493
494 /** Free an AvahiServiceTypeBrowser object */
495 void avahi_service_type_browser_free(AvahiServiceTypeBrowser *b);
496
497 /** 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. */
498 typedef struct AvahiServiceBrowser AvahiServiceBrowser;
499
500 /** Callback prototype for AvahiServiceBrowser events */
501 typedef void (*AvahiServiceBrowserCallback)(
502     AvahiServiceBrowser *b,
503     AvahiIfIndex interface,
504     AvahiProtocol protocol,
505     AvahiBrowserEvent event,
506     const gchar *name     /**< Service name, e.g. "Lennart's Files" */,
507     const gchar *type     /**< DNS-SD type, e.g. "_http._tcp" */,
508     const gchar *domain   /**< Domain of this service, e.g. "local" */,
509     gpointer userdata);
510
511 /** Create a new AvahiServiceBrowser object. */
512 AvahiServiceBrowser *avahi_service_browser_new(
513     AvahiServer *server,
514     AvahiIfIndex interface,
515     AvahiProtocol protocol,
516     const gchar *service_type /** DNS-SD service type, e.g. "_http._tcp" */,
517     const gchar *domain,
518     AvahiServiceBrowserCallback callback,
519     gpointer userdata);
520
521 /** Free an AvahiServiceBrowser object */
522 void avahi_service_browser_free(AvahiServiceBrowser *b);
523
524 /** A DNS-SD service resolver.  Use this to retrieve addres, port and TXT data for a DNS-SD service */
525 typedef struct AvahiServiceResolver AvahiServiceResolver;
526
527 /** Callback prototype for AvahiServiceResolver events */
528 typedef void (*AvahiServiceResolverCallback)(
529     AvahiServiceResolver *r,
530     AvahiIfIndex interface,
531     AvahiProtocol protocol,
532     AvahiResolverEvent event,
533     const gchar *name,       /**< Service name */
534     const gchar *type,       /**< Service Type */
535     const gchar *domain,
536     const gchar *host_name,  /**< Host name of the service */
537     const AvahiAddress *a,   /**< The resolved host name */
538     guint16 port,            /**< Service name */
539     AvahiStringList *txt,    /**< TXT record data */
540     gpointer userdata);
541
542 /** Create a new AvahiServiceResolver object */
543 AvahiServiceResolver *avahi_service_resolver_new(
544     AvahiServer *server,
545     AvahiIfIndex interface,
546     AvahiProtocol protocol,
547     const gchar *name,
548     const gchar *type,
549     const gchar *domain,
550     AvahiProtocol aprotocol,    /**< Address family of the desired service address. Use AVAHI_PROTO_UNSPEC if you don't care */
551     AvahiServiceResolverCallback calback,
552     gpointer userdata);
553
554 /** Free an AvahiServiceResolver object */
555 void avahi_service_resolver_free(AvahiServiceResolver *r);
556
557 /** A domain service browser object. Use this to browse for
558  * conventional unicast DNS servers which may be used to resolve
559  * conventional domain names */
560 typedef struct AvahiDNSServerBrowser AvahiDNSServerBrowser;
561
562 /** Callback prototype for AvahiDNSServerBrowser events */
563 typedef void (*AvahiDNSServerBrowserCallback)(
564     AvahiDNSServerBrowser *b,
565     AvahiIfIndex interface,
566     AvahiProtocol protocol,
567     AvahiBrowserEvent event,
568     const gchar *host_name,       /**< Host name of the DNS server, probably useless */
569     const AvahiAddress *a,        /**< Address of the DNS server */
570     guint16 port,                 /**< Port number of the DNS servers, probably 53 */
571     gpointer userdata);
572
573 /** Create a new AvahiDNSServerBrowser object */
574 AvahiDNSServerBrowser *avahi_dns_server_browser_new(
575     AvahiServer *server,
576     AvahiIfIndex interface,
577     AvahiProtocol protocol,
578     const gchar *domain,
579     AvahiDNSServerType type,
580     AvahiProtocol aprotocol,  /**< Address protocol for the DNS server */ 
581     AvahiDNSServerBrowserCallback callback,
582     gpointer userdata);
583
584 /** Free an AvahiDNSServerBrowser object */
585 void avahi_dns_server_browser_free(AvahiDNSServerBrowser *b);
586
587 AVAHI_C_DECL_END
588
589 #endif