From 6efe2615e04c6ef664fa9d49b013e261ba1e6e66 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 26 Oct 2005 01:21:30 +0000 Subject: * 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 --- avahi-core/Makefile.am | 2 +- avahi-core/announce.c | 1 + avahi-core/browse.c | 1 + avahi-core/cache.c | 1 + avahi-core/core.h | 18 ++---------- avahi-core/dns-srv-rr.h | 4 --- avahi-core/entry.c | 1 + avahi-core/log.h | 1 - avahi-core/lookup.h | 4 --- avahi-core/multicast-lookup.c | 1 + avahi-core/probe-sched.c | 1 + avahi-core/publish.h | 4 --- avahi-core/response-sched.c | 1 + avahi-core/rr-util.h | 64 +++++++++++++++++++++++++++++++++++++++++++ avahi-core/rr.c | 1 + avahi-core/rr.h | 37 ++----------------------- avahi-core/server.c | 1 + avahi-core/wide-area.c | 1 + 18 files changed, 79 insertions(+), 65 deletions(-) create mode 100644 avahi-core/rr-util.h (limited to 'avahi-core') 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 -- cgit