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