diff options
Diffstat (limited to 'avahi-common')
-rw-r--r-- | avahi-common/address.h | 5 | ||||
-rw-r--r-- | avahi-common/alternative.h | 6 | ||||
-rw-r--r-- | avahi-common/cdecl.h | 40 | ||||
-rw-r--r-- | avahi-common/rr.c | 14 | ||||
-rw-r--r-- | avahi-common/rr.h | 12 | ||||
-rw-r--r-- | avahi-common/strlst.h | 5 | ||||
-rw-r--r-- | avahi-common/util.h | 6 |
7 files changed, 77 insertions, 11 deletions
diff --git a/avahi-common/address.h b/avahi-common/address.h index f304345..b22b720 100644 --- a/avahi-common/address.h +++ b/avahi-common/address.h @@ -24,6 +24,9 @@ #include <sys/socket.h> #include <glib.h> +#include <avahi-common/cdecl.h> + +AVAHI_C_DECL_BEGIN /** Protocol family specification, takes the values AVAHI_INET, AVAHI_INET6, AVAHI_UNSPEC */ typedef guchar AvahiProtocol; @@ -97,4 +100,6 @@ gchar* avahi_reverse_lookup_name_ipv6_int(const AvahiIPv6Address *a); * encapsulated IPv4 address */ gboolean avahi_address_is_ipv4_in_ipv6(const AvahiAddress *a); +AVAHI_C_DECL_END + #endif diff --git a/avahi-common/alternative.h b/avahi-common/alternative.h index 3aed5b2..13620ff 100644 --- a/avahi-common/alternative.h +++ b/avahi-common/alternative.h @@ -24,6 +24,10 @@ #include <glib.h> +#include <avahi-common/cdecl.h> + +AVAHI_C_DECL_BEGIN + /** Find an alternative for the specified host name. If called with an * original host name, "2" is appended, Afterwards the number is * increased on each call. (i.e. "foo" becomes "foo2" becomes "foo3" @@ -36,4 +40,6 @@ gchar *avahi_alternative_host_name(const gchar *s); "foo #3" and so on.)*/ gchar *avahi_alternative_service_name(const gchar *s); +AVAHI_C_DECL_END + #endif diff --git a/avahi-common/cdecl.h b/avahi-common/cdecl.h new file mode 100644 index 0000000..82c687d --- /dev/null +++ b/avahi-common/cdecl.h @@ -0,0 +1,40 @@ +#ifndef foocdeclhfoo +#define foocdeclhfoo + +/* $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. +***/ + + +#ifdef __cplusplus +/** If using C++ this macro enables C mode, otherwise does nothing */ +#define AVAHI_C_DECL_BEGIN extern "C" { +/** If using C++ this macros switches back to C++ mode, otherwise does nothing */ +#define AVAHI_C_DECL_END } + +#else +/** If using C++ this macro enables C mode, otherwise does nothing */ +#define AVAHI_C_DECL_BEGIN +/** If using C++ this macros switches back to C++ mode, otherwise does nothing */ +#define AVAHI_C_DECL_END + +#endif + +#endif diff --git a/avahi-common/rr.c b/avahi-common/rr.c index b0c03a9..2a25321 100644 --- a/avahi-common/rr.c +++ b/avahi-common/rr.c @@ -39,7 +39,7 @@ AvahiKey *avahi_key_new(const gchar *name, guint16 class, guint16 type) { k = g_new(AvahiKey, 1); k->ref = 1; k->name = avahi_normalize_name(name); - k->class = class; + k->clazz = class; k->type = type; /* g_message("%p %% ref=1", k); */ @@ -189,7 +189,7 @@ gchar *avahi_key_to_string(const AvahiKey *k) { return g_strdup_printf("%s\t%s\t%s", k->name, - avahi_dns_class_to_string(k->class), + avahi_dns_class_to_string(k->clazz), avahi_dns_type_to_string(k->type)); } @@ -254,7 +254,7 @@ gboolean avahi_key_equal(const AvahiKey *a, const AvahiKey *b) { return avahi_domain_equal(a->name, b->name) && a->type == b->type && - a->class == b->class; + a->clazz == b->clazz; } gboolean avahi_key_pattern_match(const AvahiKey *pattern, const AvahiKey *k) { @@ -270,7 +270,7 @@ gboolean avahi_key_pattern_match(const AvahiKey *pattern, const AvahiKey *k) { return avahi_domain_equal(pattern->name, k->name) && (pattern->type == k->type || pattern->type == AVAHI_DNS_TYPE_ANY) && - (pattern->class == k->class || pattern->type == AVAHI_DNS_CLASS_ANY); + (pattern->clazz == k->clazz || pattern->clazz == AVAHI_DNS_CLASS_ANY); } gboolean avahi_key_is_pattern(const AvahiKey *k) { @@ -278,7 +278,7 @@ gboolean avahi_key_is_pattern(const AvahiKey *k) { return k->type == AVAHI_DNS_TYPE_ANY || - k->class == AVAHI_DNS_CLASS_ANY; + k->clazz == AVAHI_DNS_CLASS_ANY; } guint avahi_key_hash(const AvahiKey *k) { @@ -287,7 +287,7 @@ guint avahi_key_hash(const AvahiKey *k) { return avahi_domain_hash(k->name) + k->type + - k->class; + k->clazz; } static gboolean rdata_equal(const AvahiRecord *a, const AvahiRecord *b) { @@ -481,7 +481,7 @@ gint avahi_record_lexicographical_compare(AvahiRecord *a, AvahiRecord *b) { if (a == b) return 0; - if ((r = uint16_cmp(a->key->class, b->key->class)) || + if ((r = uint16_cmp(a->key->clazz, b->key->clazz)) || (r = uint16_cmp(a->key->type, b->key->type))) return r; diff --git a/avahi-common/rr.h b/avahi-common/rr.h index 7a5c0e3..1f6a4c6 100644 --- a/avahi-common/rr.h +++ b/avahi-common/rr.h @@ -26,7 +26,9 @@ #include <avahi-common/strlst.h> #include <avahi-common/address.h> +#include <avahi-common/cdecl.h> +AVAHI_C_DECL_BEGIN /** DNS record types, see RFC 1035 */ enum { @@ -64,7 +66,7 @@ enum { typedef struct { guint ref; /**< Reference counter */ gchar *name; /**< Record name */ - guint16 class; /**< Record class, one of the AVAHI_DNS_CLASS_xxx constants */ + guint16 clazz; /**< Record class, one of the AVAHI_DNS_CLASS_xxx constants */ guint16 type; /**< Record type, one of the AVAHI_DNS_TYPE_xxx constants */ } AvahiKey; @@ -119,7 +121,7 @@ typedef struct { } AvahiRecord; /** Create a new AvahiKey object. The reference counter will be set to 1. */ -AvahiKey *avahi_key_new(const gchar *name, guint16 class, guint16 type); +AvahiKey *avahi_key_new(const gchar *name, guint16 clazz, guint16 type); /** Increase the reference counter of an AvahiKey object by one */ AvahiKey *avahi_key_ref(AvahiKey *k); @@ -150,7 +152,7 @@ guint avahi_key_hash(const AvahiKey *k); AvahiRecord *avahi_record_new(AvahiKey *k, guint32 ttl); /** Create a new record object. Record data should be filled in right after creation. The reference counter is set to 1. */ -AvahiRecord *avahi_record_new_full(const gchar *name, guint16 class, guint16 type, guint32 ttl); +AvahiRecord *avahi_record_new_full(const gchar *name, guint16 clazz, guint16 type, guint32 ttl); /** Increase the reference counter of an AvahiRecord by one. */ AvahiRecord *avahi_record_ref(AvahiRecord *r); @@ -160,7 +162,7 @@ void avahi_record_unref(AvahiRecord *r); /** Return a textual representation of the specified DNS class. The * returned pointer points to a read only internal string. */ -const gchar *avahi_dns_class_to_string(guint16 class); +const gchar *avahi_dns_class_to_string(guint16 clazz); /** Return a textual representation of the specified DNS class. The * returned pointer points to a read only internal string. */ @@ -196,4 +198,6 @@ gint avahi_record_lexicographical_compare(AvahiRecord *a, AvahiRecord *b); /** Return TRUE if the specified record is an mDNS goodbye record. i.e. TTL is zero. */ gboolean avahi_record_is_goodbye(AvahiRecord *r); +AVAHI_C_DECL_END + #endif diff --git a/avahi-common/strlst.h b/avahi-common/strlst.h index 13a6b2a..1d9ef34 100644 --- a/avahi-common/strlst.h +++ b/avahi-common/strlst.h @@ -23,6 +23,9 @@ ***/ #include <glib.h> +#include <avahi-common/cdecl.h> + +AVAHI_C_DECL_BEGIN /** Linked list of strings that can contain any number of binary * characters, including NUL bytes. An empty list is created by @@ -83,5 +86,7 @@ gboolean avahi_string_list_equal(const AvahiStringList *a, const AvahiStringList /** Copy a string list */ AvahiStringList *avahi_string_list_copy(const AvahiStringList *l); +AVAHI_C_DECL_END + #endif diff --git a/avahi-common/util.h b/avahi-common/util.h index 68d367c..d590423 100644 --- a/avahi-common/util.h +++ b/avahi-common/util.h @@ -24,6 +24,10 @@ #include <glib.h> +#include <avahi-common/cdecl.h> + +AVAHI_C_DECL_BEGIN + gchar *avahi_normalize_name(const gchar *s); /* g_free() the result! */ gchar *avahi_get_host_name(void); /* g_free() the result! */ @@ -54,4 +58,6 @@ guint avahi_domain_hash(const gchar *s); gchar *avahi_format_mac_address(const guint8* mac, guint size); +AVAHI_C_DECL_END + #endif |