X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-core%2Frr.h;h=a2d430a2a90e29c2b970029c8e9333a54f9601b2;hb=cbb9be300db2c71ee56e28237c9336d37a27e411;hp=5349076144f2b0df0fb43575461688d99b78ba6b;hpb=6e35536bddb52c8e6bc201265c77a846d879b5a3;p=catta diff --git a/avahi-core/rr.h b/avahi-core/rr.h index 5349076..a2d430a 100644 --- a/avahi-core/rr.h +++ b/avahi-core/rr.h @@ -24,13 +24,13 @@ /** \file rr.h Functions and definitions for manipulating DNS resource record (RR) data. */ +#include +#include + #include #include #include -#include -#include - AVAHI_C_DECL_BEGIN /** DNS record types, see RFC 1035 */ @@ -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,9 +76,9 @@ 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 thsi record */ + AvahiKey *key; /**< Reference to the query key of this record */ uint32_t ttl; /**< DNS TTL of this record */ @@ -98,7 +98,7 @@ typedef struct { struct { char *name; - } ptr; /**< Data for PTR an CNAME records */ + } ptr, ns, cname; /**< Data for PTR, NS and CNAME records */ struct { char *cpu; @@ -135,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); @@ -169,42 +158,29 @@ const char *avahi_dns_class_to_string(uint16_t clazz); * returned pointer points to a read only internal string. */ const char *avahi_dns_type_to_string(uint16_t type); -/** Create a textual representation of the specified key. g_free() the +/** Create a textual representation of the specified key. avahi_free() the * result! */ char *avahi_key_to_string(const AvahiKey *k); /** Create a textual representation of the specified record, similar - * in style to BIND zone file data. g_free() the result! */ + * in style to BIND zone file data. avahi_free() the result! */ 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 TRUE 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); /** Check whether the specified record is valid */ int avahi_record_is_valid(AvahiRecord *r); +/** Parse a binary rdata object and fill it into *record. This function is actually implemented in dns.c */ +int avahi_rdata_parse(AvahiRecord *record, const void* rdata, size_t size); + +/** Serialize an AvahiRecord object into binary rdata. This function is actually implemented in dns.c */ +size_t avahi_rdata_serialize(AvahiRecord *record, void *rdata, size_t max_size); + AVAHI_C_DECL_END #endif