From: Lennart Poettering Date: Wed, 26 Oct 2005 01:21:30 +0000 (+0000) Subject: * remove lots of DOXYGEN_SHOULD_SKIP_THIS from the header files, use doxygen macro... X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=6efe2615e04c6ef664fa9d49b013e261ba1e6e66;p=catta * remove lots of DOXYGEN_SHOULD_SKIP_THIS from the header files, use doxygen macro expansion instead * split of exotic functions from avahi-core/rr.h to avahi-core/rr-util.h * update doxygen docs git-svn-id: file:///home/lennart/svn/public/avahi/trunk@872 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- diff --git a/avahi-client/client.h b/avahi-client/client.h index ffcc8d7..4f2250b 100644 --- a/avahi-client/client.h +++ b/avahi-client/client.h @@ -36,9 +36,7 @@ /** \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; @@ -83,8 +81,6 @@ int avahi_client_errno (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 diff --git a/avahi-client/lookup.h b/avahi-client/lookup.h index bf19479..f2db9ab 100644 --- a/avahi-client/lookup.h +++ b/avahi-client/lookup.h @@ -38,9 +38,7 @@ /** \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; @@ -209,9 +207,6 @@ AvahiClient* avahi_address_resolver_get_client (AvahiAddressResolver *); /** Free a AvahiAddressResolver resolver object */ int avahi_address_resolver_free(AvahiAddressResolver *r); -#ifndef DOXYGEN_SHOULD_SKIP_THIS AVAHI_C_DECL_END -#endif - #endif diff --git a/avahi-client/publish.h b/avahi-client/publish.h index 88c4498..7873b07 100644 --- a/avahi-client/publish.h +++ b/avahi-client/publish.h @@ -39,9 +39,7 @@ * 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; @@ -138,8 +136,6 @@ int avahi_entry_group_add_address( const char *name, const AvahiAddress *a); -#ifndef DOXYGEN_SHOULD_SKIP_THIS AVAHI_C_DECL_END -#endif #endif diff --git a/avahi-common/address.h b/avahi-common/address.h index 95eb392..53f8d06 100644 --- a/avahi-common/address.h +++ b/avahi-common/address.h @@ -29,9 +29,7 @@ #include -#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; @@ -61,17 +59,17 @@ enum { #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 { @@ -104,8 +102,6 @@ AvahiProtocol avahi_af_to_proto(int af); /** 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 diff --git a/avahi-common/alternative.h b/avahi-common/alternative.h index fa45d96..4f0e58b 100644 --- a/avahi-common/alternative.h +++ b/avahi-common/alternative.h @@ -26,9 +26,7 @@ #include -#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 @@ -42,8 +40,6 @@ char *avahi_alternative_host_name(const char *s); "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 diff --git a/avahi-common/cdecl.h b/avahi-common/cdecl.h index ca462c8..b08e2a0 100644 --- a/avahi-common/cdecl.h +++ b/avahi-common/cdecl.h @@ -23,7 +23,6 @@ ***/ /** \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" { diff --git a/avahi-common/dbus-watch-glue.h b/avahi-common/dbus-watch-glue.h index e815b45..101fa3f 100644 --- a/avahi-common/dbus-watch-glue.h +++ b/avahi-common/dbus-watch-glue.h @@ -26,6 +26,10 @@ #include +AVAHI_C_DECL_BEGIN + int avahi_dbus_connection_glue(DBusConnection *c, const AvahiPoll *poll_api); +AVAHI_C_DECL_END + #endif diff --git a/avahi-common/dbus.h b/avahi-common/dbus.h index 9cafbde..56f9d91 100644 --- a/avahi-common/dbus.h +++ b/avahi-common/dbus.h @@ -27,9 +27,7 @@ #include #include -#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" @@ -95,8 +93,6 @@ int avahi_error_dbus_to_number(const char *s); /** 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 diff --git a/avahi-common/defs.h b/avahi-common/defs.h index 2dcc829..14a0ba3 100644 --- a/avahi-common/defs.h +++ b/avahi-common/defs.h @@ -48,6 +48,20 @@ * * 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: @@ -104,8 +118,7 @@ * 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. * @@ -117,7 +130,7 @@ * 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() @@ -130,9 +143,7 @@ * */ -#ifndef DOXYGEN_SHOULD_SKIP_THIS AVAHI_C_DECL_BEGIN -#endif /** States of an entry group object */ typedef enum { @@ -214,8 +225,6 @@ 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 diff --git a/avahi-common/domain.h b/avahi-common/domain.h index e5869ce..53897e7 100644 --- a/avahi-common/domain.h +++ b/avahi-common/domain.h @@ -29,9 +29,7 @@ #include -#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 @@ -100,8 +98,6 @@ int avahi_service_name_join(char *p, size_t size, const char *name, const char * /** 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 diff --git a/avahi-common/error.h b/avahi-common/error.h index 270aece..a7c97a7 100644 --- a/avahi-common/error.h +++ b/avahi-common/error.h @@ -26,9 +26,7 @@ #include -#ifndef DOXYGEN_SHOULD_SKIP_THIS AVAHI_C_DECL_BEGIN -#endif /** Error codes used by avahi */ enum { @@ -97,8 +95,6 @@ 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 diff --git a/avahi-common/gccmacro.h b/avahi-common/gccmacro.h index 33ff847..c32a29d 100644 --- a/avahi-common/gccmacro.h +++ b/avahi-common/gccmacro.h @@ -26,9 +26,7 @@ #include -#ifndef DOXYGEN_SHOULD_SKIP_THIS AVAHI_C_DECL_BEGIN -#endif #ifdef __GNUC__ #if __GNUC__ >= 4 @@ -61,8 +59,6 @@ AVAHI_C_DECL_BEGIN #define AVAHI_GCC_NORETURN #endif -#ifndef DOXYGEN_SHOULD_SKIP_THIS AVAHI_C_DECL_END -#endif #endif diff --git a/avahi-common/llist.h b/avahi-common/llist.h index 25daf2b..37474e1 100644 --- a/avahi-common/llist.h +++ b/avahi-common/llist.h @@ -28,9 +28,7 @@ #include -#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 */ @@ -74,9 +72,6 @@ AVAHI_C_DECL_BEGIN _item->name##_next = _item->name##_prev = NULL; \ } while(0) -#ifndef DOXYGEN_SHOULD_SKIP_THIS AVAHI_C_DECL_END -#endif - #endif diff --git a/avahi-common/malloc.h b/avahi-common/malloc.h index d0e620a..d911a3a 100644 --- a/avahi-common/malloc.h +++ b/avahi-common/malloc.h @@ -60,15 +60,12 @@ char *avahi_strndup(const char *s, size_t l); 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! */ diff --git a/avahi-common/rlist.h b/avahi-common/rlist.h index 57b258c..0b88955 100644 --- a/avahi-common/rlist.h +++ b/avahi-common/rlist.h @@ -26,9 +26,7 @@ #include "llist.h" -#ifndef DOXYGEN_SHOULD_SKIP_THIS AVAHI_C_DECL_BEGIN -#endif /** A doubly linked list type */ typedef struct AvahiRList AvahiRList; @@ -48,8 +46,6 @@ AvahiRList* avahi_rlist_remove(AvahiRList *r, void *data); /** 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 diff --git a/avahi-common/simple-watch.h b/avahi-common/simple-watch.h index 5a4b37d..7c83db3 100644 --- a/avahi-common/simple-watch.h +++ b/avahi-common/simple-watch.h @@ -28,9 +28,7 @@ #include #include -#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 @@ -84,8 +82,6 @@ int avahi_simple_poll_loop(AvahiSimplePoll *s); /** 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 diff --git a/avahi-common/timeval.h b/avahi-common/timeval.h index d925719..8bdb073 100644 --- a/avahi-common/timeval.h +++ b/avahi-common/timeval.h @@ -29,9 +29,7 @@ #include -#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; @@ -53,8 +51,6 @@ AvahiUsec avahi_age(const struct timeval *a); * 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 diff --git a/avahi-common/watch.h b/avahi-common/watch.h index b973683..bc8ae2f 100644 --- a/avahi-common/watch.h +++ b/avahi-common/watch.h @@ -29,9 +29,7 @@ #include -#ifndef DOXYGEN_SHOULD_SKIP_THIS AVAHI_C_DECL_BEGIN -#endif /** An I/O watch object */ typedef struct AvahiWatch AvahiWatch; @@ -95,9 +93,7 @@ struct AvahiPoll { void (*timeout_free)(AvahiTimeout *t); }; -#ifndef DOXYGEN_SHOULD_SKIP_THIS AVAHI_C_DECL_END -#endif #endif diff --git a/avahi-core/Makefile.am b/avahi-core/Makefile.am index cc93265..edf72c1 100644 --- a/avahi-core/Makefile.am +++ b/avahi-core/Makefile.am @@ -67,7 +67,7 @@ libavahi_core_la_SOURCES = \ 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 \ diff --git a/avahi-core/announce.c b/avahi-core/announce.c index 10002b8..4fa73e2 100644 --- a/avahi-core/announce.c +++ b/avahi-core/announce.c @@ -28,6 +28,7 @@ #include "announce.h" #include "log.h" +#include "rr-util.h" #define AVAHI_ANNOUNCEMENT_JITTER_MSEC 250 #define AVAHI_PROBE_JITTER_MSEC 250 diff --git a/avahi-core/browse.c b/avahi-core/browse.c index cb2d326..caf59e7 100644 --- a/avahi-core/browse.c +++ b/avahi-core/browse.c @@ -36,6 +36,7 @@ #include "log.h" #include "querier.h" #include "domain-util.h" +#include "rr-util.h" #define AVAHI_LOOKUPS_PER_BROWSER_MAX 15 diff --git a/avahi-core/cache.c b/avahi-core/cache.c index bfbbf85..5e87706 100644 --- a/avahi-core/cache.c +++ b/avahi-core/cache.c @@ -31,6 +31,7 @@ #include "cache.h" #include "log.h" +#include "rr-util.h" #define AVAHI_CACHE_ENTRIES_MAX 500 diff --git a/avahi-core/core.h b/avahi-core/core.h index 6875218..78020ee 100644 --- a/avahi-core/core.h +++ b/avahi-core/core.h @@ -24,28 +24,16 @@ /** \file core.h The Avahi Multicast DNS and DNS Service Discovery implementation. */ - -#include - -#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 +#include #include #include #include +#include -#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 @@ -157,8 +145,6 @@ uint32_t avahi_server_get_local_service_cookie(AvahiServer *s); /** 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 diff --git a/avahi-core/dns-srv-rr.h b/avahi-core/dns-srv-rr.h index c6a5770..1a7f95f 100644 --- a/avahi-core/dns-srv-rr.h +++ b/avahi-core/dns-srv-rr.h @@ -34,9 +34,7 @@ typedef struct AvahiSDNSServerBrowser AvahiSDNSServerBrowser; #include #include -#ifndef DOXYGEN_SHOULD_SKIP_THIS AVAHI_C_DECL_BEGIN -#endif /** The type of DNS server */ typedef enum { @@ -86,8 +84,6 @@ AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new( /** Free an AvahiSDNSServerBrowser object */ void avahi_s_dns_server_browser_free(AvahiSDNSServerBrowser *b); -#ifndef DOXYGEN_SHOULD_SKIP_THIS AVAHI_C_DECL_END -#endif #endif diff --git a/avahi-core/entry.c b/avahi-core/entry.c index 89f313e..7afad47 100644 --- a/avahi-core/entry.c +++ b/avahi-core/entry.c @@ -45,6 +45,7 @@ #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; diff --git a/avahi-core/log.h b/avahi-core/log.h index bb32ccc..25e3940 100644 --- a/avahi-core/log.h +++ b/avahi-core/log.h @@ -70,7 +70,6 @@ void avahi_log_info(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12; /** Shortcut for avahi_log(AVAHI_LOG_DEBUG, ...) */ void avahi_log_debug(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12; - AVAHI_C_DECL_END #endif diff --git a/avahi-core/lookup.h b/avahi-core/lookup.h index f66a086..0ce6fe8 100644 --- a/avahi-core/lookup.h +++ b/avahi-core/lookup.h @@ -52,9 +52,7 @@ typedef struct AvahiSServiceResolver AvahiSServiceResolver; #include #include -#ifndef DOXYGEN_SHOULD_SKIP_THIS AVAHI_C_DECL_BEGIN -#endif /** Callback prototype for AvahiSRecordBrowser events */ typedef void (*AvahiSRecordBrowserCallback)( @@ -234,8 +232,6 @@ AvahiSServiceResolver *avahi_s_service_resolver_new( /** Free an AvahiSServiceResolver object */ void avahi_s_service_resolver_free(AvahiSServiceResolver *r); -#ifndef DOXYGEN_SHOULD_SKIP_THIS AVAHI_C_DECL_END -#endif #endif diff --git a/avahi-core/multicast-lookup.c b/avahi-core/multicast-lookup.c index 7ae45ea..fa8c859 100644 --- a/avahi-core/multicast-lookup.c +++ b/avahi-core/multicast-lookup.c @@ -32,6 +32,7 @@ #include "log.h" #include "hashmap.h" #include "multicast-lookup.h" +#include "rr-util.h" struct AvahiMulticastLookup { AvahiMulticastLookupEngine *engine; diff --git a/avahi-core/probe-sched.c b/avahi-core/probe-sched.c index 71359b5..7a302c3 100644 --- a/avahi-core/probe-sched.c +++ b/avahi-core/probe-sched.c @@ -29,6 +29,7 @@ #include "probe-sched.h" #include "log.h" +#include "rr-util.h" #define AVAHI_PROBE_HISTORY_MSEC 150 #define AVAHI_PROBE_DEFER_MSEC 50 diff --git a/avahi-core/publish.h b/avahi-core/publish.h index 281ed42..77c49af 100644 --- a/avahi-core/publish.h +++ b/avahi-core/publish.h @@ -34,9 +34,7 @@ typedef struct AvahiSEntryGroup AvahiSEntryGroup; #include #include -#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); @@ -174,8 +172,6 @@ int avahi_server_update_service_txt( /** 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 diff --git a/avahi-core/response-sched.c b/avahi-core/response-sched.c index 65a32af..6883771 100644 --- a/avahi-core/response-sched.c +++ b/avahi-core/response-sched.c @@ -28,6 +28,7 @@ #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 diff --git a/avahi-core/rr-util.h b/avahi-core/rr-util.h new file mode 100644 index 0000000..b3c35b4 --- /dev/null +++ b/avahi-core/rr-util.h @@ -0,0 +1,64 @@ +#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 diff --git a/avahi-core/rr.c b/avahi-core/rr.c index e7fac13..e88d3c6 100644 --- a/avahi-core/rr.c +++ b/avahi-core/rr.c @@ -38,6 +38,7 @@ #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; diff --git a/avahi-core/rr.h b/avahi-core/rr.h index 21d6d63..a2d430a 100644 --- a/avahi-core/rr.h +++ b/avahi-core/rr.h @@ -66,7 +66,7 @@ enum { 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 */ @@ -76,7 +76,7 @@ typedef struct { /** 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 */ @@ -124,9 +124,6 @@ typedef struct { /** 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); @@ -138,17 +135,6 @@ void avahi_key_unref(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); @@ -183,25 +169,6 @@ char *avahi_record_to_string(const AvahiRecord *r); /** 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); diff --git a/avahi-core/server.c b/avahi-core/server.c index 5cac056..7b0a56e 100644 --- a/avahi-core/server.c +++ b/avahi-core/server.c @@ -47,6 +47,7 @@ #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); diff --git a/avahi-core/wide-area.c b/avahi-core/wide-area.c index d12267a..51e192e 100644 --- a/avahi-core/wide-area.c +++ b/avahi-core/wide-area.c @@ -39,6 +39,7 @@ #include "hashmap.h" #include "wide-area.h" #include "addr-util.h" +#include "rr-util.h" #define CACHE_ENTRIES_MAX 500 diff --git a/avahi-glib/glib-malloc.h b/avahi-glib/glib-malloc.h index 7ce8269..5982e08 100644 --- a/avahi-glib/glib-malloc.h +++ b/avahi-glib/glib-malloc.h @@ -29,17 +29,13 @@ #include #include -#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 diff --git a/avahi-glib/glib-watch.h b/avahi-glib/glib-watch.h index e890a68..895a686 100644 --- a/avahi-glib/glib-watch.h +++ b/avahi-glib/glib-watch.h @@ -29,9 +29,7 @@ #include #include -#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; @@ -50,8 +48,6 @@ void avahi_glib_poll_free(AvahiGLibPoll *g); * call */ const AvahiPoll *avahi_glib_poll_get(AvahiGLibPoll *g); -#ifndef DOXYGEN_SHOULD_SKIP_THIS AVAHI_C_DECL_END -#endif #endif diff --git a/avahi-qt/qt-watch.h b/avahi-qt/qt-watch.h index f6447ab..0a3476d 100644 --- a/avahi-qt/qt-watch.h +++ b/avahi-qt/qt-watch.h @@ -26,17 +26,11 @@ #include -#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 diff --git a/doxygen.cfg b/doxygen.cfg index 3ee8daf..eee8b1d 100644 --- a/doxygen.cfg +++ b/doxygen.cfg @@ -169,12 +169,12 @@ PERLMOD_MAKEVAR_PREFIX = # 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 #---------------------------------------------------------------------------