diff options
author | Bob Halley <halley@dnspython.org> | 2009-03-31 01:03:55 +0000 |
---|---|---|
committer | Bob Halley <halley@dnspython.org> | 2009-03-31 01:03:55 +0000 |
commit | 636966b5c99aac056a981bac62bd18af7f2b1250 (patch) | |
tree | 90e711c001874df186c2a3dc86286bba758d4d95 | |
parent | 68480dc55511008abaa9d9c5c9e6df5b39643781 (diff) | |
download | dnspython-636966b5c99aac056a981bac62bd18af7f2b1250.tar.gz |
add more type codes, make NSEC a singleton, fix whitespace
-rw-r--r-- | dns/rdatatype.py | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/dns/rdatatype.py b/dns/rdatatype.py index 432733a..924290f 100644 --- a/dns/rdatatype.py +++ b/dns/rdatatype.py @@ -76,6 +76,9 @@ RRSIG = 46 NSEC = 47 DNSKEY = 48 DHCID = 49 +NSEC3 = 50 +NSEC3PARAM = 51 +HIP = 55 SPF = 99 UNSPEC = 103 TKEY = 249 @@ -85,6 +88,8 @@ AXFR = 252 MAILB = 253 MAILA = 254 ANY = 255 +TA = 32768 +DLV = 32769 _by_text = { 'NONE' : NONE, @@ -133,6 +138,9 @@ _by_text = { 'NSEC' : NSEC, 'DNSKEY' : DNSKEY, 'DHCID' : DHCID, + 'NSEC3' : NSEC3, + 'NSEC3PARAM' : NSEC3PARAM, + 'HIP' : HIP, 'SPF' : SPF, 'UNSPEC' : UNSPEC, 'TKEY' : TKEY, @@ -141,7 +149,9 @@ _by_text = { 'AXFR' : AXFR, 'MAILB' : MAILB, 'MAILA' : MAILA, - 'ANY' : ANY + 'ANY' : ANY, + 'TA' : TA, + 'DLV' : DLV, } # We construct the inverse mapping programmatically to ensure that we @@ -159,6 +169,7 @@ _singletons = { SOA : True, NXT : True, DNAME : True, + NSEC : True, # CNAME is technically a singleton, but we allow multiple CNAMEs. } @@ -175,7 +186,7 @@ def from_text(text): @raises dns.rdatatype.UnknownRdatatype: the type is unknown @raises ValueError: the rdata type value is not >= 0 and <= 65535 @rtype: int""" - + value = _by_text.get(text.upper()) if value is None: match = _unknown_type_pattern.match(text) @@ -192,7 +203,7 @@ def to_text(value): @type value: int @raises ValueError: the rdata type value is not >= 0 and <= 65535 @rtype: string""" - + if value < 0 or value > 65535: raise ValueError, "type must be between >= 0 and <= 65535" text = _by_value.get(value) @@ -205,7 +216,7 @@ def is_metatype(rdtype): @param rdtype: the type @type rdtype: int @rtype: bool""" - + if rdtype >= TKEY and rdtype <= ANY or _metatypes.has_key(rdtype): return True return False @@ -215,7 +226,7 @@ def is_singleton(rdtype): @param rdtype: the type @type rdtype: int @rtype: bool""" - + if _singletons.has_key(rdtype): return True return False |