/** \example glib-integration.c Example of how to integrate
* avahi use with GLIB/GTK applications */
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** A connection context */
typedef struct AvahiClient AvahiClient;
/** Return the local service cookie. returns AVAHI_SERVICE_COOKIE_INVALID on failure. */
uint32_t avahi_client_get_local_service_cookie(AvahiClient *client);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
/** \example client-browse-services.c Example how to browse for DNS-SD
* services using the client interface to avahi-daemon. */
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** A domain browser object */
typedef struct AvahiDomainBrowser AvahiDomainBrowser;
/** Free a AvahiAddressResolver resolver object */
int avahi_address_resolver_free(AvahiAddressResolver *r);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
-
#endif
* service using the client interface to avahi-daemon. It behaves like a network
* printer registering both an IPP and a BSD LPR service. */
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** An entry group object */
typedef struct AvahiEntryGroup AvahiEntryGroup;
const char *name,
const AvahiAddress *a);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
#include <avahi-common/cdecl.h>
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** Protocol family specification, takes the values AVAHI_PROTO_INET, AVAHI_PROTO_INET6, AVAHI_PROTO_UNSPEC */
typedef int AvahiProtocol;
#define AVAHI_PROTO_VALID(protocol) (((protocol) == AVAHI_PROTO_INET) || ((protocol) == AVAHI_PROTO_INET6) || ((protocol) == AVAHI_PROTO_UNSPEC))
/** An IPv4 address */
-typedef struct {
+typedef struct AvahiIPv4Address {
uint32_t address; /**< Address data in network byte order. */
} AvahiIPv4Address;
/** An IPv6 address */
-typedef struct {
+typedef struct AvahiIPv6Address {
uint8_t address[16]; /**< Address data */
} AvahiIPv6Address;
/** Protocol (address family) independent address structure */
-typedef struct {
+typedef struct AvahiAddress {
AvahiProtocol proto; /**< Address family */
union {
/** Return a textual representation of the specified protocol number. i.e. "IPv4", "IPv6" or "UNSPEC" */
const char* avahi_proto_to_string(AvahiProtocol proto);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
#include <avahi-common/cdecl.h>
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** Find an alternative for the specified host name. If called with an
* original host name, "2" is appended, Afterwards the number is
"foo #3" and so on.) avahi_free() the result. */
char *avahi_alternative_service_name(const char *s);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
***/
/** \file cdecl.h C++ compatibility */
-
#ifdef __cplusplus
/** If using C++ this macro enables C mode, otherwise does nothing */
#define AVAHI_C_DECL_BEGIN extern "C" {
#include <avahi-common/watch.h>
+AVAHI_C_DECL_BEGIN
+
int avahi_dbus_connection_glue(DBusConnection *c, const AvahiPoll *poll_api);
+AVAHI_C_DECL_END
+
#endif
#include <avahi-common/cdecl.h>
#include <dbus/dbus.h>
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
#define AVAHI_DBUS_NAME "org.freedesktop.Avahi"
#define AVAHI_DBUS_INTERFACE_SERVER AVAHI_DBUS_NAME".Server"
/** Convert an Avahi error number into a DBus error string. Result should not be freed */
const char * avahi_error_number_to_dbus(int error);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
*
* All three APIs are very similar, however avahi-core is the most powerful.
*
+ * In addition to the three APIs described above Avahi supports two
+ * compatibility libraries:
+ *
+ * \li avahi-compat-libdns_sd: the original Bonjour API as documented
+ * in the header file "dns_sd.h" by Apple Computer, Inc.
+ *
+ * \li avahi-compat-howl: the HOWL API as released with HOWL 0.9.8 by
+ * Porchdog Software.
+ *
+ * Please note that these compatibility layers are incomplete and
+ * generally a waste of resources. We strongly encourage everyone to
+ * use our native APIs for newly written programs and to port older
+ * programs to one of them!
+ *
* \section error_reporting Error Reporting
*
* Some notes on the Avahi error handling:
* avahi_alternative_service_name()) and commit again. Please do not
* free the entry group and create a new one. This would inhibit some
* traffic limiting algorithms in mDNS.
- * - When you need to modify your services, reset the entry group
- * (i.e. avahi_entry_group_reset()) and add them back. Please do not
+ * - When you need to modify your services, use the AVAHI_PUBLISH_UPDATE flag. Please do not
* free the entry group and create a new one. This would inhibit some
* traffic limiting algorithms in mDNS.
*
* for the service type you want to browse for. Use
* avahi_client_resolve_service() to acquire service data for a a service
* name.
- * - You can use avahi_domain_browser() to get a list of announced
+ * - You can use avahi_domain_browser_new() to get a list of announced
* browsing domains. Please note that not all domains whith services
* on the LAN are mandatorily announced.
* - Network monitor software may use avahi_service_type_browser_new()
*
*/
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** States of an entry group object */
typedef enum {
/** In invalid cookie as special value */
#define AVAHI_SERVICE_COOKIE_INVALID (0)
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
#include <avahi-common/cdecl.h>
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** The maximum length of a a fully escaped domain name C string. This
* is calculated like this: RFC1034 mandates maximum length of FQDNs
/** Split a full service name into name, type and domain */
int avahi_service_name_split(const char *p, char *name, size_t name_size, char *type, size_t type_size, char *domain, size_t domain_size);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
#include <avahi-common/cdecl.h>
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** Error codes used by avahi */
enum {
/** Return a human readable error string for the specified error code */
const char *avahi_strerror(int error);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
#include <avahi-common/cdecl.h>
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
#ifdef __GNUC__
#if __GNUC__ >= 4
#define AVAHI_GCC_NORETURN
#endif
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
#include <avahi-common/cdecl.h>
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** The head of the linked list. Use this in the structure that shall
* contain the head of the linked list */
_item->name##_next = _item->name##_prev = NULL; \
} while(0)
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
-
#endif
void *avahi_memdup(const void *s, size_t l);
/** Wraps allocator functions */
-typedef struct AvahiAllocator AvahiAllocator;
-
-/** Wraps allocator functions */
-struct AvahiAllocator {
+typedef struct AvahiAllocator {
void* (*malloc)(size_t size);
void (*free)(void *p);
void* (*realloc)(void *p, size_t size);
void* (*calloc)(size_t nmemb, size_t size); /**< May be NULL */
-};
+} AvahiAllocator;
/** Change the allocator. May be NULL to return to default (libc)
* allocators. The structure is not copied! */
#include "llist.h"
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** A doubly linked list type */
typedef struct AvahiRList AvahiRList;
/** Remove the specified item from the list and return the new beginning */
AvahiRList* avahi_rlist_remove_by_link(AvahiRList *r, AvahiRList *n);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
#include <avahi-common/cdecl.h>
#include <avahi-common/watch.h>
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** A main loop object. Main loops of this type aren't very flexible
* since they only support a single wakeup type. Nevertheless it
/** Wakeup the main loop. (for threaded environments) */
void avahi_simple_poll_wakeup(AvahiSimplePoll *s);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
#include <avahi-common/cdecl.h>
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** A numeric data type for storing microsecond values. (signed 64bit integer) */
typedef int64_t AvahiUsec;
* the jitter */
struct timeval *avahi_elapse_time(struct timeval *tv, unsigned ms, unsigned j);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
#include <avahi-common/cdecl.h>
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** An I/O watch object */
typedef struct AvahiWatch AvahiWatch;
void (*timeout_free)(AvahiTimeout *t);
};
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
browse-service.c \
resolve-service.c \
dns.c dns.h \
- rr.c rr.h \
+ rr.c rr.h rr-util.h \
core.h lookup.h publish.h \
log.c log.h \
browse-dns-server.c \
#include "announce.h"
#include "log.h"
+#include "rr-util.h"
#define AVAHI_ANNOUNCEMENT_JITTER_MSEC 250
#define AVAHI_PROBE_JITTER_MSEC 250
#include "log.h"
#include "querier.h"
#include "domain-util.h"
+#include "rr-util.h"
#define AVAHI_LOOKUPS_PER_BROWSER_MAX 15
#include "cache.h"
#include "log.h"
+#include "rr-util.h"
#define AVAHI_CACHE_ENTRIES_MAX 500
/** \file core.h The Avahi Multicast DNS and DNS Service Discovery implementation. */
-
-#include <avahi-common/cdecl.h>
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-AVAHI_C_DECL_BEGIN
-#endif
-
/** An mDNS responder object */
typedef struct AvahiServer AvahiServer;
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-AVAHI_C_DECL_END
-#endif
-
-#include <avahi-core/rr.h>
+#include <avahi-common/cdecl.h>
#include <avahi-common/address.h>
#include <avahi-common/defs.h>
#include <avahi-common/watch.h>
+#include <avahi-core/rr.h>
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** Maximum number of defined DNS servers for wide area DNS */
#define AVAHI_WIDE_AREA_SERVERS_MAX 4
/** Set the wide area DNS servers */
int avahi_server_set_wide_area_servers(AvahiServer *s, const AvahiAddress *a, unsigned n);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
#include <avahi-core/core.h>
#include <avahi-core/publish.h>
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** The type of DNS server */
typedef enum {
/** Free an AvahiSDNSServerBrowser object */
void avahi_s_dns_server_browser_free(AvahiSDNSServerBrowser *b);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
#include "log.h"
#include "util.h"
#include "dns-srv-rr.h"
+#include "rr-util.h"
void avahi_entry_free(AvahiServer*s, AvahiEntry *e) {
AvahiEntry *t;
/** Shortcut for avahi_log(AVAHI_LOG_DEBUG, ...) */
void avahi_log_debug(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12;
-
AVAHI_C_DECL_END
#endif
#include <avahi-common/defs.h>
#include <avahi-core/core.h>
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** Callback prototype for AvahiSRecordBrowser events */
typedef void (*AvahiSRecordBrowserCallback)(
/** Free an AvahiSServiceResolver object */
void avahi_s_service_resolver_free(AvahiSServiceResolver *r);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
#include "log.h"
#include "hashmap.h"
#include "multicast-lookup.h"
+#include "rr-util.h"
struct AvahiMulticastLookup {
AvahiMulticastLookupEngine *engine;
#include "probe-sched.h"
#include "log.h"
+#include "rr-util.h"
#define AVAHI_PROBE_HISTORY_MSEC 150
#define AVAHI_PROBE_DEFER_MSEC 50
#include <avahi-common/cdecl.h>
#include <avahi-core/core.h>
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** Prototype for callback functions which are called whenever the state of an AvahiSEntryGroup object changes */
typedef void (*AvahiSEntryGroupCallback) (AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void* userdata);
/** Check if there is a service locally defined and return the entry group it is attached to. Returns NULL if the service isn't local*/
int avahi_server_get_group_of_service(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain, AvahiSEntryGroup** ret_group);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
#include "response-sched.h"
#include "log.h"
+#include "rr-util.h"
/* Local packets are supressed this long after sending them */
#define AVAHI_RESPONSE_HISTORY_MSEC 500
--- /dev/null
+#ifndef foorrutilhfoo
+#define foorrutilhfoo
+
+/* $Id$ */
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with avahi; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA.
+***/
+
+#include "rr.h"
+
+AVAHI_C_DECL_BEGIN
+
+/** Creaze new AvahiKey object based on an existing key but replaceing the type by CNAME */
+AvahiKey *avahi_key_new_cname(AvahiKey *key);
+
+/** Match a key to a key pattern. The pattern has a type of
+AVAHI_DNS_CLASS_ANY, the classes are taken to be equal. Same for the
+type. If the pattern has neither class nor type with ANY constants,
+this function is identical to avahi_key_equal(). In contrast to
+avahi_equal() this function is not commutative. */
+int avahi_key_pattern_match(const AvahiKey *pattern, const AvahiKey *k);
+
+/** Check whether a key is a pattern key, i.e. the class/type has a
+ * value of AVAHI_DNS_CLASS_ANY/AVAHI_DNS_TYPE_ANY */
+int avahi_key_is_pattern(const AvahiKey *k);
+
+/** Returns a maximum estimate for the space that is needed to store
+ * this key in a DNS packet. */
+size_t avahi_key_get_estimate_size(AvahiKey *k);
+
+/** Returns a maximum estimate for the space that is needed to store
+ * the record in a DNS packet. */
+size_t avahi_record_get_estimate_size(AvahiRecord *r);
+
+/** Do a mDNS spec conforming lexicographical comparison of the two
+ * records. Return a negative value if a < b, a positive if a > b,
+ * zero if equal. */
+int avahi_record_lexicographical_compare(AvahiRecord *a, AvahiRecord *b);
+
+/** Return 1 if the specified record is an mDNS goodbye record. i.e. TTL is zero. */
+int avahi_record_is_goodbye(AvahiRecord *r);
+
+/** Make a deep copy of an AvahiRecord object */
+AvahiRecord *avahi_record_copy(AvahiRecord *r);
+
+AVAHI_C_DECL_END
+
+#endif
#include "util.h"
#include "hashmap.h"
#include "domain-util.h"
+#include "rr-util.h"
AvahiKey *avahi_key_new(const char *name, uint16_t class, uint16_t type) {
AvahiKey *k;
name. Use avahi_key_ref()/avahi_key_unref() for manipulating the
reference counter. The structure is intended to be treated as "immutable", no
changes should be imposed after creation */
-typedef struct {
+typedef struct AvahiKey {
int ref; /**< Reference counter */
char *name; /**< Record name */
uint16_t clazz; /**< Record class, one of the AVAHI_DNS_CLASS_xxx constants */
/** Encapsulates a DNS resource record. The structure is intended to
* be treated as "immutable", no changes should be imposed after
* creation. */
-typedef struct {
+typedef struct AvahiRecord {
int ref; /**< Reference counter */
AvahiKey *key; /**< Reference to the query key of this record */
/** Create a new AvahiKey object. The reference counter will be set to 1. */
AvahiKey *avahi_key_new(const char *name, uint16_t clazz, uint16_t type);
-/** Creaze new AvahiKey object based on an existing key but replaceing the type by CNAME */
-AvahiKey *avahi_key_new_cname(AvahiKey *key);
-
/** Increase the reference counter of an AvahiKey object by one */
AvahiKey *avahi_key_ref(AvahiKey *k);
* other class/type. */
int avahi_key_equal(const AvahiKey *a, const AvahiKey *b);
-/** Match a key to a key pattern. The pattern has a type of
-AVAHI_DNS_CLASS_ANY, the classes are taken to be equal. Same for the
-type. If the pattern has neither class nor type with ANY constants,
-this function is identical to avahi_key_equal(). In contrast to
-avahi_equal() this function is not commutative. */
-int avahi_key_pattern_match(const AvahiKey *pattern, const AvahiKey *k);
-
-/** Check whether a key is a pattern key, i.e. the class/type has a
- * value of AVAHI_DNS_CLASS_ANY/AVAHI_DNS_TYPE_ANY */
-int avahi_key_is_pattern(const AvahiKey *k);
-
/** Return a numeric hash value for a key for usage in hash tables. */
unsigned avahi_key_hash(const AvahiKey *k);
/** Check whether two records are equal (regardless of the TTL */
int avahi_record_equal_no_ttl(const AvahiRecord *a, const AvahiRecord *b);
-/** Make a deep copy of an AvahiRecord object */
-AvahiRecord *avahi_record_copy(AvahiRecord *r);
-
-/** Returns a maximum estimate for the space that is needed to store
- * this key in a DNS packet. */
-size_t avahi_key_get_estimate_size(AvahiKey *k);
-
-/** Returns a maximum estimate for the space that is needed to store
- * the record in a DNS packet. */
-size_t avahi_record_get_estimate_size(AvahiRecord *r);
-
-/** Do a mDNS spec conforming lexicographical comparison of the two
- * records. Return a negative value if a < b, a positive if a > b,
- * zero if equal. */
-int avahi_record_lexicographical_compare(AvahiRecord *a, AvahiRecord *b);
-
-/** Return 1 if the specified record is an mDNS goodbye record. i.e. TTL is zero. */
-int avahi_record_is_goodbye(AvahiRecord *r);
-
/** Check whether the specified key is valid */
int avahi_key_is_valid(AvahiKey *k);
#include "dns-srv-rr.h"
#include "addr-util.h"
#include "domain-util.h"
+#include "rr-util.h"
static void enum_aux_records(AvahiServer *s, AvahiInterface *i, const char *name, uint16_t type, void (*callback)(AvahiServer *s, AvahiRecord *r, int flush_cache, void* userdata), void* userdata) {
assert(s);
#include "hashmap.h"
#include "wide-area.h"
#include "addr-util.h"
+#include "rr-util.h"
#define CACHE_ENTRIES_MAX 500
#include <avahi-common/cdecl.h>
#include <avahi-common/malloc.h>
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** Return a pointer to a memory allocator that uses GLib's g_malloc()
and frinds. Th returned structure is statically allocated, and needs
not to be copied or freed. Pass this directly to avahi_set_allocator(). */
const AvahiAllocator * avahi_glib_allocator(void);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
#include <avahi-common/cdecl.h>
#include <avahi-common/watch.h>
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
/** GLib main loop adapter. You can safely cast this into a GSource */
typedef struct AvahiGLibPoll AvahiGLibPoll;
* call */
const AvahiPoll *avahi_glib_poll_get(AvahiGLibPoll *g);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
#include <avahi-common/watch.h>
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
-#endif
-
-/**
-Setup abstract poll structure for integration with Qt main loop */
+/** Setup abstract poll structure for integration with Qt main loop */
const AvahiPoll* avahi_qt_poll_get(void);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
-#endif
#endif
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
+MACRO_EXPANSION = YES
+EXPAND_ONLY_PREDEF = YES
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
-PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS
+PREDEFINED = "DOXYGEN_SHOULD_SKIP_THIS" "AVAHI_C_DECL_BEGIN=" "AVAHI_C_DECL_END="
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------