diff options
| -rw-r--r-- | avahi-core/domain-util.c | 16 | ||||
| -rw-r--r-- | avahi-core/domain-util.h | 3 | ||||
| -rw-r--r-- | avahi-core/rr.h | 4 | 
3 files changed, 21 insertions, 2 deletions
diff --git a/avahi-core/domain-util.c b/avahi-core/domain-util.c index 0d6ba14..7f562db 100644 --- a/avahi-core/domain-util.c +++ b/avahi-core/domain-util.c @@ -237,4 +237,18 @@ uint8_t avahi_count_canonical_labels(const char* input){      }      return count; -}
\ No newline at end of file +} + +/* reference keytag generator from RFC 4034 */ +/* invoke with avahi_keytag(<rdata>, <rdlength>); */ +uint16_t avahi_keytag(uint8_t key[], uint16_t keysize){ +    uint32_t ac; +    int i; + +    for (ac = 0, i = 0; i < keysize; ++i) +        ac += (i & 1) ? key[i] : key[i] << 8; + +    ac += (ac >> 16) & 0xFFFF; + +    return ac & 0xFFFF; +   } diff --git a/avahi-core/domain-util.h b/avahi-core/domain-util.h index c3e3579..2e4cf3d 100644 --- a/avahi-core/domain-util.h +++ b/avahi-core/domain-util.h @@ -48,6 +48,9 @@ unsigned char * avahi_c_to_canonical_string(const char* input);  /** returns the number of labels in a canonical DNS domain */  uint8_t avahi_count_canonical_labels(const char* input); +/* reference keytag generator from RFC 4034 */ +uint16_t avahi_keytag(uint8_t key[], uint16_t keysize) +  AVAHI_C_DECL_END  #endif diff --git a/avahi-core/rr.h b/avahi-core/rr.h index fc6a0e6..2437ef2 100644 --- a/avahi-core/rr.h +++ b/avahi-core/rr.h @@ -52,7 +52,9 @@ enum {  /**DNSSEC protocol constants */  enum { -    AVAHI_DNSSEC_PROTO = 0x3 +    AVAHI_DNSSEC_PROTO = 0x3, +    AVAHI_DNSSEC_VALIDITY = 30, +    AVAHI_DNSSEC_TIME_DRIFT = 3600  };  /** DNS record classes, see RFC 1035, in addition to those defined in defs.h */  | 
