diff options
author | Lennart Poettering <lennart@poettering.net> | 2005-10-10 22:34:06 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2005-10-10 22:34:06 +0000 |
commit | d1dd07145bb3db5c6fd77c55aea762eb79ab3b5c (patch) | |
tree | f50a23c8d0faad85af129a2bac6fb3c08724cdab /avahi-core/rr.c | |
parent | 1c22aa6ce3490c7f5447179b4ec2e6113881660e (diff) |
* rename avahi_service_name_snprint() to avahi_service_name_join()
* add avahi_service_name_split() and make everything use it
* change avahi_normalize_name() to work on a supplied buffer instead of malloc'ed memory.
* add avahi_normalize_name_strdup() that retains the old behaviour avahi_normalize_name()
* same thing for avahi_get_host_name()/avahi_get_host_name_strdup()
* Rewrite domain name escaping and validity checking code
* Remove superfluous memory allocationsfrom various browsers and do some other major cleanups
* add new global macro AVAHI_CHECK_VALIDITY_RETURN_NULL() and modify many things to make use of it
* add AVAHI_LABEL_MAX
* patch everything to make use of AVAHI_LABEL_MAX and AVAHI_DOMAIN_NAME_MAX
* add pretty printing for NS records
* add partial pretty printing for SOA records
* add many more validity checks to various user API functions
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@708 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-core/rr.c')
-rw-r--r-- | avahi-core/rr.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/avahi-core/rr.c b/avahi-core/rr.c index 90c6236..c1faa50 100644 --- a/avahi-core/rr.c +++ b/avahi-core/rr.c @@ -47,7 +47,7 @@ AvahiKey *avahi_key_new(const char *name, uint16_t class, uint16_t type) { return NULL; } - if (!(k->name = avahi_normalize_name(name))) { + if (!(k->name = avahi_normalize_name_strdup(name))) { avahi_log_error("avahi_normalize_name() failed."); avahi_free(k); return NULL; @@ -155,6 +155,7 @@ void avahi_record_unref(AvahiRecord *r) { case AVAHI_DNS_TYPE_PTR: case AVAHI_DNS_TYPE_CNAME: + case AVAHI_DNS_TYPE_NS: avahi_free(r->data.ptr.name); break; @@ -212,6 +213,10 @@ const char *avahi_dns_type_to_string(uint16_t type) { return "SRV"; case AVAHI_DNS_TYPE_ANY: return "ANY"; + case AVAHI_DNS_TYPE_SOA: + return "SOA"; + case AVAHI_DNS_TYPE_NS: + return "NS"; default: return NULL; } @@ -244,7 +249,8 @@ char *avahi_record_to_string(const AvahiRecord *r) { break; case AVAHI_DNS_TYPE_PTR: - case AVAHI_DNS_TYPE_CNAME : + case AVAHI_DNS_TYPE_CNAME: + case AVAHI_DNS_TYPE_NS: t = r->data.ptr.name; break; @@ -348,6 +354,7 @@ static int rdata_equal(const AvahiRecord *a, const AvahiRecord *b) { case AVAHI_DNS_TYPE_PTR: case AVAHI_DNS_TYPE_CNAME: + case AVAHI_DNS_TYPE_NS: return avahi_domain_equal(a->data.ptr.name, b->data.ptr.name); case AVAHI_DNS_TYPE_HINFO: @@ -399,6 +406,7 @@ AvahiRecord *avahi_record_copy(AvahiRecord *r) { switch (r->key->type) { case AVAHI_DNS_TYPE_PTR: case AVAHI_DNS_TYPE_CNAME: + case AVAHI_DNS_TYPE_NS: if (!(copy->data.ptr.name = avahi_strdup(r->data.ptr.name))) goto fail; break; @@ -468,6 +476,7 @@ size_t avahi_record_get_estimate_size(AvahiRecord *r) { switch (r->key->type) { case AVAHI_DNS_TYPE_PTR: case AVAHI_DNS_TYPE_CNAME: + case AVAHI_DNS_TYPE_NS: n += strlen(r->data.ptr.name) + 1; break; @@ -543,6 +552,7 @@ int avahi_record_lexicographical_compare(AvahiRecord *a, AvahiRecord *b) { case AVAHI_DNS_TYPE_PTR: case AVAHI_DNS_TYPE_CNAME: + case AVAHI_DNS_TYPE_NS: return avahi_binary_domain_cmp(a->data.ptr.name, b->data.ptr.name); case AVAHI_DNS_TYPE_SRV: { @@ -640,6 +650,7 @@ int avahi_record_is_valid(AvahiRecord *r) { case AVAHI_DNS_TYPE_PTR: case AVAHI_DNS_TYPE_CNAME: + case AVAHI_DNS_TYPE_NS: return avahi_is_valid_domain_name(r->data.ptr.name); case AVAHI_DNS_TYPE_SRV: |