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