X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-common%2Frr.c;h=2a25321f4c2dc1ae971701efbaf62edf8ba4eb1c;hb=9a8842d77ec6a2e2f566c5970562d278ae52610e;hp=13160fcbc2d8222fa0d3e5519c5b2df19fb12e08;hpb=9962a048634c590db23a00db1d01daada779844c;p=catta diff --git a/avahi-common/rr.c b/avahi-common/rr.c index 13160fc..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); */ @@ -70,7 +70,7 @@ void avahi_key_unref(AvahiKey *k) { } } -AvahiRecord *avahi_record_new(AvahiKey *k) { +AvahiRecord *avahi_record_new(AvahiKey *k, guint32 ttl) { AvahiRecord *r; g_assert(k); @@ -81,19 +81,19 @@ AvahiRecord *avahi_record_new(AvahiKey *k) { memset(&r->data, 0, sizeof(r->data)); - r->ttl = AVAHI_DEFAULT_TTL; + r->ttl = ttl != (guint32) -1 ? ttl : AVAHI_DEFAULT_TTL; return r; } -AvahiRecord *avahi_record_new_full(const gchar *name, guint16 class, guint16 type) { +AvahiRecord *avahi_record_new_full(const gchar *name, guint16 class, guint16 type, guint32 ttl) { AvahiRecord *r; AvahiKey *k; g_assert(name); k = avahi_key_new(name, class, type); - r = avahi_record_new(k); + r = avahi_record_new(k, ttl); avahi_key_unref(k); return r; @@ -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;