]> git.meshlink.io Git - catta/blobdiff - avahi-core/core.h
updated INSTALL
[catta] / avahi-core / core.h
index c09aec46121935691c1845c6e4e75f6ba29eb04f..f51bd6b59143d0af2f4548a3e7e25effa53ea547 100644 (file)
 
 /** \file core.h The Avahi Multicast DNS and DNS Service Discovery implmentation. */
 
+/** \example publish-service.c Example how to register a DNS-SD
+ * service using an embedded mDNS stack. It behaves like a network
+ * printer registering both an IPP and a BSD LPR service. */
+
+/** \example browse-services.c Example how to browse for DNS-SD
+ * services using an embedded mDNS stack. */
+
 #include <avahi-common/cdecl.h>
 
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
 AVAHI_C_DECL_BEGIN
+#endif
 
 /** An mDNS responder object */
 typedef struct AvahiServer AvahiServer;
@@ -39,22 +48,19 @@ typedef struct AvahiEntry AvahiEntry;
 /** A group of locally registered DNS RRs */
 typedef struct AvahiEntryGroup AvahiEntryGroup;
 
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
 AVAHI_C_DECL_END
+#endif
 
+#include <avahi-core/rr.h>
 #include <avahi-common/address.h>
-#include <avahi-common/rr.h>
 #include <avahi-common/alternative.h>
+#include <avahi-common/error.h>
+#include <avahi-common/defs.h>
 
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
 AVAHI_C_DECL_BEGIN
-
-/** States of a server object */
-typedef enum {
-    AVAHI_SERVER_INVALID = -1,     /**< Invalid state (initial) */ 
-    AVAHI_SERVER_REGISTERING = 0,  /**< Host RRs are being registered */
-    AVAHI_SERVER_RUNNING,          /**< All host RRs have been established */
-    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() */
-    AVAHI_SERVER_SLEEPING          /**< The host or domain name has changed and the server waits for old entries to be expired */
-} AvahiServerState;
+#endif
 
 /** Flags for server entries */
 typedef enum {
@@ -65,14 +71,6 @@ typedef enum {
     AVAHI_ENTRY_ALLOWMUTIPLE = 8   /**< Allow multiple local records of this type, even if they are intended to be unique */
 } AvahiEntryFlags;
 
-/** States of an entry group object */
-typedef enum {
-    AVAHI_ENTRY_GROUP_UNCOMMITED = -1,   /**< The group has not yet been commited, the user must still call avahi_entry_group_commit() */
-    AVAHI_ENTRY_GROUP_REGISTERING = 0,   /**< The entries of the group are currently being registered */
-    AVAHI_ENTRY_GROUP_ESTABLISHED,       /**< The entries have successfully been established */
-    AVAHI_ENTRY_GROUP_COLLISION          /**< A name collision for one of the entries in the group has been detected, the entries have been withdrawn */ 
-} AvahiEntryGroupState;
-
 /** Prototype for callback functions which are called whenever the state of an AvahiServer object changes */
 typedef void (*AvahiServerCallback) (AvahiServer *s, AvahiServerState state, gpointer userdata);
 
@@ -100,7 +98,8 @@ AvahiServer *avahi_server_new(
     GMainContext *c,               /**< The GLIB main loop context to attach to */
     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. */
     AvahiServerCallback callback,  /**< A callback which is called whenever the state of the server changes */
-    gpointer userdata              /**< An opaque pointer which is passed to the callback function */);
+    gpointer userdata,             /**< An opaque pointer which is passed to the callback function */
+    gint *error);
 
 /** Free an mDNS responder object */
 void avahi_server_free(AvahiServer* s);
@@ -189,6 +188,12 @@ void avahi_entry_group_free(AvahiEntryGroup *g);
 /** Commit an entry group. This starts the probing and registration process for all RRs in the group */
 gint avahi_entry_group_commit(AvahiEntryGroup *g);
 
+/** Remove all entries from the entry group and reset the state to AVAHI_ENTRY_GROUP_UNCOMMITED. */
+void avahi_entry_group_reset(AvahiEntryGroup *g);
+
+/** Return TRUE if the entry group is empty, i.e. has no records attached. */
+gboolean avahi_entry_group_is_empty(AvahiEntryGroup *g);
+
 /** Return the current state of the specified entry group */
 AvahiEntryGroupState avahi_entry_group_get_state(AvahiEntryGroup *g);
 
@@ -253,7 +258,7 @@ gint avahi_server_add_txt_strlst(
     AvahiEntryFlags flags,
     guint32 ttl,
     const gchar *name,
-    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(). */ );
+    AvahiStringList *strlst  /**< TXT decord data as a AvahiString. This routine makes a deep copy of this object. */ );
 
 /** Add an IP address mapping to the server. This will add both the
  * host-name-to-address and the reverse mapping to the server. See
@@ -302,7 +307,7 @@ gint avahi_server_add_service_va(
     guint16 port,
     va_list va);
 
-/** 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. */
+/** Mostly identical to avahi_server_add_service(), but takes an AvahiStringList object for the TXT records.  The AvahiStringList object is copied. */
 gint avahi_server_add_service_strlst(
     AvahiServer *s,
     AvahiEntryGroup *g,
@@ -347,18 +352,6 @@ gint avahi_server_add_dns_server_name(
     const gchar *name,
     guint16 port /** should be 53 */);
 
-/** Type of callback event when browsing */
-typedef enum {
-    AVAHI_BROWSER_NEW = 0,            /**< The object is new on the network */
-    AVAHI_BROWSER_REMOVE = -1         /**< The object has been removed from the network */
-} AvahiBrowserEvent;
-
-/** Type of callback event when resolving */
-typedef enum {
-    AVAHI_RESOLVER_FOUND = 0,         /**< RR found, resolving successful */
-    AVAHI_RESOLVER_TIMEOUT = -1       /**< Noone responded within the timeout, resolving failed */
-} AvahiResolverEvent;
-
 /** A browsing object for arbitrary RRs */
 typedef struct AvahiRecordBrowser AvahiRecordBrowser;
 
@@ -434,16 +427,6 @@ AvahiAddressResolver *avahi_address_resolver_new(
 /** Free an AvahiAddressResolver object */
 void avahi_address_resolver_free(AvahiAddressResolver *r);
 
-/** The type of domain to browse for */
-typedef enum {
-    AVAHI_DOMAIN_BROWSER_REGISTER,          /**< Browse for a list of available registering domains */
-    AVAHI_DOMAIN_BROWSER_REGISTER_DEFAULT,  /**< Browse for the default registering domain */
-    AVAHI_DOMAIN_BROWSER_BROWSE,            /**< Browse for a list of available browsing domains */
-    AVAHI_DOMAIN_BROWSER_BROWSE_DEFAULT,    /**< Browse for the default browsing domain */
-    AVAHI_DOMAIN_BROWSER_BROWSE_LEGACY,     /**< Legacy browse domain - see DNS-SD spec for more information */
-    AVAHI_DOMAIN_BROWSER_MAX
-} AvahiDomainBrowserType;
-
 /** A local domain browsing object. May be used to enumerate domains used on the local LAN */
 typedef struct AvahiDomainBrowser AvahiDomainBrowser;
 
@@ -584,6 +567,11 @@ AvahiDNSServerBrowser *avahi_dns_server_browser_new(
 /** Free an AvahiDNSServerBrowser object */
 void avahi_dns_server_browser_free(AvahiDNSServerBrowser *b);
 
+/** Return the last error code */
+gint avahi_server_errno(AvahiServer *s);
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
 AVAHI_C_DECL_END
+#endif
 
 #endif