From 4bbc3ff037026c72f3249f59c1b5af69a6ad6d69 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 29 Mar 2010 16:08:11 +0200 Subject: s4-python: Move dnspython to lib/, like the other Python modules This also avoids it from being installed if it's already present on the system. --- lib/dnspython/dns/rdtypes/ANY/AFSDB.py | 51 +++++ lib/dnspython/dns/rdtypes/ANY/CERT.py | 131 +++++++++++ lib/dnspython/dns/rdtypes/ANY/CNAME.py | 24 ++ lib/dnspython/dns/rdtypes/ANY/DLV.py | 20 ++ lib/dnspython/dns/rdtypes/ANY/DNAME.py | 21 ++ lib/dnspython/dns/rdtypes/ANY/DNSKEY.py | 25 +++ lib/dnspython/dns/rdtypes/ANY/DS.py | 20 ++ lib/dnspython/dns/rdtypes/ANY/GPOS.py | 156 +++++++++++++ lib/dnspython/dns/rdtypes/ANY/HINFO.py | 83 +++++++ lib/dnspython/dns/rdtypes/ANY/HIP.py | 140 ++++++++++++ lib/dnspython/dns/rdtypes/ANY/ISDN.py | 96 ++++++++ lib/dnspython/dns/rdtypes/ANY/KEY.py | 20 ++ lib/dnspython/dns/rdtypes/ANY/LOC.py | 334 ++++++++++++++++++++++++++++ lib/dnspython/dns/rdtypes/ANY/MX.py | 20 ++ lib/dnspython/dns/rdtypes/ANY/NS.py | 20 ++ lib/dnspython/dns/rdtypes/ANY/NSEC.py | 141 ++++++++++++ lib/dnspython/dns/rdtypes/ANY/NSEC3.py | 182 +++++++++++++++ lib/dnspython/dns/rdtypes/ANY/NSEC3PARAM.py | 88 ++++++++ lib/dnspython/dns/rdtypes/ANY/NXT.py | 99 +++++++++ lib/dnspython/dns/rdtypes/ANY/PTR.py | 20 ++ lib/dnspython/dns/rdtypes/ANY/RP.py | 86 +++++++ lib/dnspython/dns/rdtypes/ANY/RRSIG.py | 20 ++ lib/dnspython/dns/rdtypes/ANY/RT.py | 20 ++ lib/dnspython/dns/rdtypes/ANY/SIG.py | 26 +++ lib/dnspython/dns/rdtypes/ANY/SOA.py | 127 +++++++++++ lib/dnspython/dns/rdtypes/ANY/SPF.py | 22 ++ lib/dnspython/dns/rdtypes/ANY/SSHFP.py | 77 +++++++ lib/dnspython/dns/rdtypes/ANY/TXT.py | 20 ++ lib/dnspython/dns/rdtypes/ANY/X25.py | 62 ++++++ lib/dnspython/dns/rdtypes/ANY/__init__.py | 48 ++++ 30 files changed, 2199 insertions(+) create mode 100644 lib/dnspython/dns/rdtypes/ANY/AFSDB.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/CERT.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/CNAME.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/DLV.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/DNAME.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/DNSKEY.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/DS.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/GPOS.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/HINFO.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/HIP.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/ISDN.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/KEY.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/LOC.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/MX.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/NS.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/NSEC.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/NSEC3.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/NSEC3PARAM.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/NXT.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/PTR.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/RP.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/RRSIG.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/RT.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/SIG.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/SOA.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/SPF.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/SSHFP.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/TXT.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/X25.py create mode 100644 lib/dnspython/dns/rdtypes/ANY/__init__.py (limited to 'lib/dnspython/dns/rdtypes/ANY') diff --git a/lib/dnspython/dns/rdtypes/ANY/AFSDB.py b/lib/dnspython/dns/rdtypes/ANY/AFSDB.py new file mode 100644 index 0000000000..e8ca6f5cbb --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/AFSDB.py @@ -0,0 +1,51 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.rdtypes.mxbase + +class AFSDB(dns.rdtypes.mxbase.UncompressedDowncasingMX): + """AFSDB record + + @ivar subtype: the subtype value + @type subtype: int + @ivar hostname: the hostname name + @type hostname: dns.name.Name object""" + + # Use the property mechanism to make "subtype" an alias for the + # "preference" attribute, and "hostname" an alias for the "exchange" + # attribute. + # + # This lets us inherit the UncompressedMX implementation but lets + # the caller use appropriate attribute names for the rdata type. + # + # We probably lose some performance vs. a cut-and-paste + # implementation, but this way we don't copy code, and that's + # good. + + def get_subtype(self): + return self.preference + + def set_subtype(self, subtype): + self.preference = subtype + + subtype = property(get_subtype, set_subtype) + + def get_hostname(self): + return self.exchange + + def set_hostname(self, hostname): + self.exchange = hostname + + hostname = property(get_hostname, set_hostname) diff --git a/lib/dnspython/dns/rdtypes/ANY/CERT.py b/lib/dnspython/dns/rdtypes/ANY/CERT.py new file mode 100644 index 0000000000..d2703519d5 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/CERT.py @@ -0,0 +1,131 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import cStringIO +import struct + +import dns.exception +import dns.dnssec +import dns.rdata +import dns.tokenizer + +_ctype_by_value = { + 1 : 'PKIX', + 2 : 'SPKI', + 3 : 'PGP', + 253 : 'URI', + 254 : 'OID', + } + +_ctype_by_name = { + 'PKIX' : 1, + 'SPKI' : 2, + 'PGP' : 3, + 'URI' : 253, + 'OID' : 254, + } + +def _ctype_from_text(what): + v = _ctype_by_name.get(what) + if not v is None: + return v + return int(what) + +def _ctype_to_text(what): + v = _ctype_by_value.get(what) + if not v is None: + return v + return str(what) + +class CERT(dns.rdata.Rdata): + """CERT record + + @ivar certificate_type: certificate type + @type certificate_type: int + @ivar key_tag: key tag + @type key_tag: int + @ivar algorithm: algorithm + @type algorithm: int + @ivar certificate: the certificate or CRL + @type certificate: string + @see: RFC 2538""" + + __slots__ = ['certificate_type', 'key_tag', 'algorithm', 'certificate'] + + def __init__(self, rdclass, rdtype, certificate_type, key_tag, algorithm, + certificate): + super(CERT, self).__init__(rdclass, rdtype) + self.certificate_type = certificate_type + self.key_tag = key_tag + self.algorithm = algorithm + self.certificate = certificate + + def to_text(self, origin=None, relativize=True, **kw): + certificate_type = _ctype_to_text(self.certificate_type) + return "%s %d %s %s" % (certificate_type, self.key_tag, + dns.dnssec.algorithm_to_text(self.algorithm), + dns.rdata._base64ify(self.certificate)) + + def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True): + certificate_type = _ctype_from_text(tok.get_string()) + key_tag = tok.get_uint16() + algorithm = dns.dnssec.algorithm_from_text(tok.get_string()) + if algorithm < 0 or algorithm > 255: + raise dns.exception.SyntaxError("bad algorithm type") + chunks = [] + while 1: + t = tok.get().unescape() + if t.is_eol_or_eof(): + break + if not t.is_identifier(): + raise dns.exception.SyntaxError + chunks.append(t.value) + b64 = ''.join(chunks) + certificate = b64.decode('base64_codec') + return cls(rdclass, rdtype, certificate_type, key_tag, + algorithm, certificate) + + from_text = classmethod(from_text) + + def to_wire(self, file, compress = None, origin = None): + prefix = struct.pack("!HHB", self.certificate_type, self.key_tag, + self.algorithm) + file.write(prefix) + file.write(self.certificate) + + def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None): + prefix = wire[current : current + 5] + current += 5 + rdlen -= 5 + if rdlen < 0: + raise dns.exception.FormError + (certificate_type, key_tag, algorithm) = struct.unpack("!HHB", prefix) + certificate = wire[current : current + rdlen] + return cls(rdclass, rdtype, certificate_type, key_tag, algorithm, + certificate) + + from_wire = classmethod(from_wire) + + def _cmp(self, other): + f = cStringIO.StringIO() + self.to_wire(f) + wire1 = f.getvalue() + f.seek(0) + f.truncate() + other.to_wire(f) + wire2 = f.getvalue() + f.close() + + return cmp(wire1, wire2) diff --git a/lib/dnspython/dns/rdtypes/ANY/CNAME.py b/lib/dnspython/dns/rdtypes/ANY/CNAME.py new file mode 100644 index 0000000000..7f5c4b3bd7 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/CNAME.py @@ -0,0 +1,24 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.rdtypes.nsbase + +class CNAME(dns.rdtypes.nsbase.NSBase): + """CNAME record + + Note: although CNAME is officially a singleton type, dnspython allows + non-singleton CNAME rdatasets because such sets have been commonly + used by BIND and other nameservers for load balancing.""" + pass diff --git a/lib/dnspython/dns/rdtypes/ANY/DLV.py b/lib/dnspython/dns/rdtypes/ANY/DLV.py new file mode 100644 index 0000000000..07b9548342 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/DLV.py @@ -0,0 +1,20 @@ +# Copyright (C) 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.rdtypes.dsbase + +class DLV(dns.rdtypes.dsbase.DSBase): + """DLV record""" + pass diff --git a/lib/dnspython/dns/rdtypes/ANY/DNAME.py b/lib/dnspython/dns/rdtypes/ANY/DNAME.py new file mode 100644 index 0000000000..99b5013f33 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/DNAME.py @@ -0,0 +1,21 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.rdtypes.nsbase + +class DNAME(dns.rdtypes.nsbase.UncompressedNS): + """DNAME record""" + def to_digestable(self, origin = None): + return self.target.to_digestable(origin) diff --git a/lib/dnspython/dns/rdtypes/ANY/DNSKEY.py b/lib/dnspython/dns/rdtypes/ANY/DNSKEY.py new file mode 100644 index 0000000000..ad66ef0c69 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/DNSKEY.py @@ -0,0 +1,25 @@ +# Copyright (C) 2004-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.rdtypes.keybase + +# flag constants +SEP = 0x0001 +REVOKE = 0x0080 +ZONE = 0x0100 + +class DNSKEY(dns.rdtypes.keybase.KEYBase): + """DNSKEY record""" + pass diff --git a/lib/dnspython/dns/rdtypes/ANY/DS.py b/lib/dnspython/dns/rdtypes/ANY/DS.py new file mode 100644 index 0000000000..3a06f448f7 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/DS.py @@ -0,0 +1,20 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.rdtypes.dsbase + +class DS(dns.rdtypes.dsbase.DSBase): + """DS record""" + pass diff --git a/lib/dnspython/dns/rdtypes/ANY/GPOS.py b/lib/dnspython/dns/rdtypes/ANY/GPOS.py new file mode 100644 index 0000000000..aa8000f8ca --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/GPOS.py @@ -0,0 +1,156 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.exception +import dns.rdata +import dns.tokenizer + +def _validate_float_string(what): + if what[0] == '-' or what[0] == '+': + what = what[1:] + if what.isdigit(): + return + (left, right) = what.split('.') + if left == '' and right == '': + raise dns.exception.FormError + if not left == '' and not left.isdigit(): + raise dns.exception.FormError + if not right == '' and not right.isdigit(): + raise dns.exception.FormError + +class GPOS(dns.rdata.Rdata): + """GPOS record + + @ivar latitude: latitude + @type latitude: string + @ivar longitude: longitude + @type longitude: string + @ivar altitude: altitude + @type altitude: string + @see: RFC 1712""" + + __slots__ = ['latitude', 'longitude', 'altitude'] + + def __init__(self, rdclass, rdtype, latitude, longitude, altitude): + super(GPOS, self).__init__(rdclass, rdtype) + if isinstance(latitude, float) or \ + isinstance(latitude, int) or \ + isinstance(latitude, long): + latitude = str(latitude) + if isinstance(longitude, float) or \ + isinstance(longitude, int) or \ + isinstance(longitude, long): + longitude = str(longitude) + if isinstance(altitude, float) or \ + isinstance(altitude, int) or \ + isinstance(altitude, long): + altitude = str(altitude) + _validate_float_string(latitude) + _validate_float_string(longitude) + _validate_float_string(altitude) + self.latitude = latitude + self.longitude = longitude + self.altitude = altitude + + def to_text(self, origin=None, relativize=True, **kw): + return '%s %s %s' % (self.latitude, self.longitude, self.altitude) + + def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True): + latitude = tok.get_string() + longitude = tok.get_string() + altitude = tok.get_string() + tok.get_eol() + return cls(rdclass, rdtype, latitude, longitude, altitude) + + from_text = classmethod(from_text) + + def to_wire(self, file, compress = None, origin = None): + l = len(self.latitude) + assert l < 256 + byte = chr(l) + file.write(byte) + file.write(self.latitude) + l = len(self.longitude) + assert l < 256 + byte = chr(l) + file.write(byte) + file.write(self.longitude) + l = len(self.altitude) + assert l < 256 + byte = chr(l) + file.write(byte) + file.write(self.altitude) + + def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None): + l = ord(wire[current]) + current += 1 + rdlen -= 1 + if l > rdlen: + raise dns.exception.FormError + latitude = wire[current : current + l] + current += l + rdlen -= l + l = ord(wire[current]) + current += 1 + rdlen -= 1 + if l > rdlen: + raise dns.exception.FormError + longitude = wire[current : current + l] + current += l + rdlen -= l + l = ord(wire[current]) + current += 1 + rdlen -= 1 + if l != rdlen: + raise dns.exception.FormError + altitude = wire[current : current + l] + return cls(rdclass, rdtype, latitude, longitude, altitude) + + from_wire = classmethod(from_wire) + + def _cmp(self, other): + v = cmp(self.latitude, other.latitude) + if v == 0: + v = cmp(self.longitude, other.longitude) + if v == 0: + v = cmp(self.altitude, other.altitude) + return v + + def _get_float_latitude(self): + return float(self.latitude) + + def _set_float_latitude(self, value): + self.latitude = str(value) + + float_latitude = property(_get_float_latitude, _set_float_latitude, + doc="latitude as a floating point value") + + def _get_float_longitude(self): + return float(self.longitude) + + def _set_float_longitude(self, value): + self.longitude = str(value) + + float_longitude = property(_get_float_longitude, _set_float_longitude, + doc="longitude as a floating point value") + + def _get_float_altitude(self): + return float(self.altitude) + + def _set_float_altitude(self, value): + self.altitude = str(value) + + float_altitude = property(_get_float_altitude, _set_float_altitude, + doc="altitude as a floating point value") diff --git a/lib/dnspython/dns/rdtypes/ANY/HINFO.py b/lib/dnspython/dns/rdtypes/ANY/HINFO.py new file mode 100644 index 0000000000..5cfef5a932 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/HINFO.py @@ -0,0 +1,83 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.exception +import dns.rdata +import dns.tokenizer + +class HINFO(dns.rdata.Rdata): + """HINFO record + + @ivar cpu: the CPU type + @type cpu: string + @ivar os: the OS type + @type os: string + @see: RFC 1035""" + + __slots__ = ['cpu', 'os'] + + def __init__(self, rdclass, rdtype, cpu, os): + super(HINFO, self).__init__(rdclass, rdtype) + self.cpu = cpu + self.os = os + + def to_text(self, origin=None, relativize=True, **kw): + return '"%s" "%s"' % (dns.rdata._escapify(self.cpu), + dns.rdata._escapify(self.os)) + + def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True): + cpu = tok.get_string() + os = tok.get_string() + tok.get_eol() + return cls(rdclass, rdtype, cpu, os) + + from_text = classmethod(from_text) + + def to_wire(self, file, compress = None, origin = None): + l = len(self.cpu) + assert l < 256 + byte = chr(l) + file.write(byte) + file.write(self.cpu) + l = len(self.os) + assert l < 256 + byte = chr(l) + file.write(byte) + file.write(self.os) + + def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None): + l = ord(wire[current]) + current += 1 + rdlen -= 1 + if l > rdlen: + raise dns.exception.FormError + cpu = wire[current : current + l] + current += l + rdlen -= l + l = ord(wire[current]) + current += 1 + rdlen -= 1 + if l != rdlen: + raise dns.exception.FormError + os = wire[current : current + l] + return cls(rdclass, rdtype, cpu, os) + + from_wire = classmethod(from_wire) + + def _cmp(self, other): + v = cmp(self.cpu, other.cpu) + if v == 0: + v = cmp(self.os, other.os) + return v diff --git a/lib/dnspython/dns/rdtypes/ANY/HIP.py b/lib/dnspython/dns/rdtypes/ANY/HIP.py new file mode 100644 index 0000000000..8f96ae93d6 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/HIP.py @@ -0,0 +1,140 @@ +# Copyright (C) 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import cStringIO +import string +import struct + +import dns.exception +import dns.rdata +import dns.rdatatype + +class HIP(dns.rdata.Rdata): + """HIP record + + @ivar hit: the host identity tag + @type hit: string + @ivar algorithm: the public key cryptographic algorithm + @type algorithm: int + @ivar key: the public key + @type key: string + @ivar servers: the rendezvous servers + @type servers: list of dns.name.Name objects + @see: RFC 5205""" + + __slots__ = ['hit', 'algorithm', 'key', 'servers'] + + def __init__(self, rdclass, rdtype, hit, algorithm, key, servers): + super(HIP, self).__init__(rdclass, rdtype) + self.hit = hit + self.algorithm = algorithm + self.key = key + self.servers = servers + + def to_text(self, origin=None, relativize=True, **kw): + hit = self.hit.encode('hex-codec') + key = self.key.encode('base64-codec').replace('\n', '') + text = '' + servers = [] + for server in self.servers: + servers.append(str(server.choose_relativity(origin, relativize))) + if len(servers) > 0: + text += (' ' + ' '.join(servers)) + return '%u %s %s%s' % (self.algorithm, hit, key, text) + + def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True): + algorithm = tok.get_uint8() + hit = tok.get_string().decode('hex-codec') + if len(hit) > 255: + raise dns.exception.SyntaxError("HIT too long") + key = tok.get_string().decode('base64-codec') + servers = [] + while 1: + token = tok.get() + if token.is_eol_or_eof(): + break + server = dns.name.from_text(token.value, origin) + server.choose_relativity(origin, relativize) + servers.append(server) + return cls(rdclass, rdtype, hit, algorithm, key, servers) + + from_text = classmethod(from_text) + + def to_wire(self, file, compress = None, origin = None): + lh = len(self.hit) + lk = len(self.key) + file.write(struct.pack("!BBH", lh, self.algorithm, lk)) + file.write(self.hit) + file.write(self.key) + for server in self.servers: + server.to_wire(file, None, origin) + + def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None): + (lh, algorithm, lk) = struct.unpack('!BBH', + wire[current : current + 4]) + current += 4 + rdlen -= 4 + hit = wire[current : current + lh] + current += lh + rdlen -= lh + key = wire[current : current + lk] + current += lk + rdlen -= lk + servers = [] + while rdlen > 0: + (server, cused) = dns.name.from_wire(wire[: current + rdlen], + current) + current += cused + rdlen -= cused + if not origin is None: + server = server.relativize(origin) + servers.append(server) + return cls(rdclass, rdtype, hit, algorithm, key, servers) + + from_wire = classmethod(from_wire) + + def choose_relativity(self, origin = None, relativize = True): + servers = [] + for server in self.servers: + server = server.choose_relativity(origin, relativize) + servers.append(server) + self.servers = servers + + def _cmp(self, other): + b1 = cStringIO.StringIO() + lh = len(self.hit) + lk = len(self.key) + b1.write(struct.pack("!BBH", lh, self.algorithm, lk)) + b1.write(self.hit) + b1.write(self.key) + b2 = cStringIO.StringIO() + lh = len(other.hit) + lk = len(other.key) + b2.write(struct.pack("!BBH", lh, other.algorithm, lk)) + b2.write(other.hit) + b2.write(other.key) + v = cmp(b1.getvalue(), b2.getvalue()) + if v != 0: + return v + ls = len(self.servers) + lo = len(other.servers) + count = min(ls, lo) + i = 0 + while i < count: + v = cmp(self.servers[i], other.servers[i]) + if v != 0: + return v + i += 1 + return ls - lo diff --git a/lib/dnspython/dns/rdtypes/ANY/ISDN.py b/lib/dnspython/dns/rdtypes/ANY/ISDN.py new file mode 100644 index 0000000000..424d3a9a3c --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/ISDN.py @@ -0,0 +1,96 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.exception +import dns.rdata +import dns.tokenizer + +class ISDN(dns.rdata.Rdata): + """ISDN record + + @ivar address: the ISDN address + @type address: string + @ivar subaddress: the ISDN subaddress (or '' if not present) + @type subaddress: string + @see: RFC 1183""" + + __slots__ = ['address', 'subaddress'] + + def __init__(self, rdclass, rdtype, address, subaddress): + super(ISDN, self).__init__(rdclass, rdtype) + self.address = address + self.subaddress = subaddress + + def to_text(self, origin=None, relativize=True, **kw): + if self.subaddress: + return '"%s" "%s"' % (dns.rdata._escapify(self.address), + dns.rdata._escapify(self.subaddress)) + else: + return '"%s"' % dns.rdata._escapify(self.address) + + def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True): + address = tok.get_string() + t = tok.get() + if not t.is_eol_or_eof(): + tok.unget(t) + subaddress = tok.get_string() + else: + tok.unget(t) + subaddress = '' + tok.get_eol() + return cls(rdclass, rdtype, address, subaddress) + + from_text = classmethod(from_text) + + def to_wire(self, file, compress = None, origin = None): + l = len(self.address) + assert l < 256 + byte = chr(l) + file.write(byte) + file.write(self.address) + l = len(self.subaddress) + if l > 0: + assert l < 256 + byte = chr(l) + file.write(byte) + file.write(self.subaddress) + + def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None): + l = ord(wire[current]) + current += 1 + rdlen -= 1 + if l > rdlen: + raise dns.exception.FormError + address = wire[current : current + l] + current += l + rdlen -= l + if rdlen > 0: + l = ord(wire[current]) + current += 1 + rdlen -= 1 + if l != rdlen: + raise dns.exception.FormError + subaddress = wire[current : current + l] + else: + subaddress = '' + return cls(rdclass, rdtype, address, subaddress) + + from_wire = classmethod(from_wire) + + def _cmp(self, other): + v = cmp(self.address, other.address) + if v == 0: + v = cmp(self.subaddress, other.subaddress) + return v diff --git a/lib/dnspython/dns/rdtypes/ANY/KEY.py b/lib/dnspython/dns/rdtypes/ANY/KEY.py new file mode 100644 index 0000000000..c8581edbeb --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/KEY.py @@ -0,0 +1,20 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.rdtypes.keybase + +class KEY(dns.rdtypes.keybase.KEYBase): + """KEY record""" + pass diff --git a/lib/dnspython/dns/rdtypes/ANY/LOC.py b/lib/dnspython/dns/rdtypes/ANY/LOC.py new file mode 100644 index 0000000000..518dd6010f --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/LOC.py @@ -0,0 +1,334 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import cStringIO +import struct + +import dns.exception +import dns.rdata + +_pows = (1L, 10L, 100L, 1000L, 10000L, 100000L, 1000000L, 10000000L, + 100000000L, 1000000000L, 10000000000L) + +def _exponent_of(what, desc): + exp = None + for i in xrange(len(_pows)): + if what // _pows[i] == 0L: + exp = i - 1 + break + if exp is None or exp < 0: + raise dns.exception.SyntaxError("%s value out of bounds" % desc) + return exp + +def _float_to_tuple(what): + if what < 0: + sign = -1 + what *= -1 + else: + sign = 1 + what = long(round(what * 3600000)) + degrees = int(what // 3600000) + what -= degrees * 3600000 + minutes = int(what // 60000) + what -= minutes * 60000 + seconds = int(what // 1000) + what -= int(seconds * 1000) + what = int(what) + return (degrees * sign, minutes, seconds, what) + +def _tuple_to_float(what): + if what[0] < 0: + sign = -1 + value = float(what[0]) * -1 + else: + sign = 1 + value = float(what[0]) + value += float(what[1]) / 60.0 + value += float(what[2]) / 3600.0 + value += float(what[3]) / 3600000.0 + return sign * value + +def _encode_size(what, desc): + what = long(what); + exponent = _exponent_of(what, desc) & 0xF + base = what // pow(10, exponent) & 0xF + return base * 16 + exponent + +def _decode_size(what, desc): + exponent = what & 0x0F + if exponent > 9: + raise dns.exception.SyntaxError("bad %s exponent" % desc) + base = (what & 0xF0) >> 4 + if base > 9: + raise dns.exception.SyntaxError("bad %s base" % desc) + return long(base) * pow(10, exponent) + +class LOC(dns.rdata.Rdata): + """LOC record + + @ivar latitude: latitude + @type latitude: (int, int, int, int) tuple specifying the degrees, minutes, + seconds, and milliseconds of the coordinate. + @ivar longitude: longitude + @type longitude: (int, int, int, int) tuple specifying the degrees, + minutes, seconds, and milliseconds of the coordinate. + @ivar altitude: altitude + @type altitude: float + @ivar size: size of the sphere + @type size: float + @ivar horizontal_precision: horizontal precision + @type horizontal_precision: float + @ivar vertical_precision: vertical precision + @type vertical_precision: float + @see: RFC 1876""" + + __slots__ = ['latitude', 'longitude', 'altitude', 'size', + 'horizontal_precision', 'vertical_precision'] + + def __init__(self, rdclass, rdtype, latitude, longitude, altitude, + size=1.0, hprec=10000.0, vprec=10.0): + """Initialize a LOC record instance. + + The parameters I{latitude} and I{longitude} may be either a 4-tuple + of integers specifying (degrees, minutes, seconds, milliseconds), + or they may be floating point values specifying the number of + degrees. The other parameters are floats.""" + + super(LOC, self).__init__(rdclass, rdtype) + if isinstance(latitude, int) or isinstance(latitude, long): + latitude = float(latitude) + if isinstance(latitude, float): + latitude = _float_to_tuple(latitude) + self.latitude = latitude + if isinstance(longitude, int) or isinstance(longitude, long): + longitude = float(longitude) + if isinstance(longitude, float): + longitude = _float_to_tuple(longitude) + self.longitude = longitude + self.altitude = float(altitude) + self.size = float(size) + self.horizontal_precision = float(hprec) + self.vertical_precision = float(vprec) + + def to_text(self, origin=None, relativize=True, **kw): + if self.latitude[0] > 0: + lat_hemisphere = 'N' + lat_degrees = self.latitude[0] + else: + lat_hemisphere = 'S' + lat_degrees = -1 * self.latitude[0] + if self.longitude[0] > 0: + long_hemisphere = 'E' + long_degrees = self.longitude[0] + else: + long_hemisphere = 'W' + long_degrees = -1 * self.longitude[0] + text = "%d %d %d.%03d %s %d %d %d.%03d %s %0.2fm" % ( + lat_degrees, self.latitude[1], self.latitude[2], self.latitude[3], + lat_hemisphere, long_degrees, self.longitude[1], self.longitude[2], + self.longitude[3], long_hemisphere, self.altitude / 100.0 + ) + + if self.size != 1.0 or self.horizontal_precision != 10000.0 or \ + self.vertical_precision != 10.0: + text += " %0.2fm %0.2fm %0.2fm" % ( + self.size / 100.0, self.horizontal_precision / 100.0, + self.vertical_precision / 100.0 + ) + return text + + def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True): + latitude = [0, 0, 0, 0] + longitude = [0, 0, 0, 0] + size = 1.0 + hprec = 10000.0 + vprec = 10.0 + + latitude[0] = tok.get_int() + t = tok.get_string() + if t.isdigit(): + latitude[1] = int(t) + t = tok.get_string() + if '.' in t: + (seconds, milliseconds) = t.split('.') + if not seconds.isdigit(): + raise dns.exception.SyntaxError('bad latitude seconds value') + latitude[2] = int(seconds) + if latitude[2] >= 60: + raise dns.exception.SyntaxError('latitude seconds >= 60') + l = len(milliseconds) + if l == 0 or l > 3 or not milliseconds.isdigit(): + raise dns.exception.SyntaxError('bad latitude milliseconds value') + if l == 1: + m = 100 + elif l == 2: + m = 10 + else: + m = 1 + latitude[3] = m * int(milliseconds) + t = tok.get_string() + elif t.isdigit(): + latitude[2] = int(t) + t = tok.get_string() + if t == 'S': + latitude[0] *= -1 + elif t != 'N': + raise dns.exception.SyntaxError('bad latitude hemisphere value') + + longitude[0] = tok.get_int() + t = tok.get_string() + if t.isdigit(): + longitude[1] = int(t) + t = tok.get_string() + if '.' in t: + (seconds, milliseconds) = t.split('.') + if not seconds.isdigit(): + raise dns.exception.SyntaxError('bad longitude seconds value') + longitude[2] = int(seconds) + if longitude[2] >= 60: + raise dns.exception.SyntaxError('longitude seconds >= 60') + l = len(milliseconds) + if l == 0 or l > 3 or not milliseconds.isdigit(): + raise dns.exception.SyntaxError('bad longitude milliseconds value') + if l == 1: + m = 100 + elif l == 2: + m = 10 + else: + m = 1 + longitude[3] = m * int(milliseconds) + t = tok.get_string() + elif t.isdigit(): + longitude[2] = int(t) + t = tok.get_string() + if t == 'W': + longitude[0] *= -1 + elif t != 'E': + raise dns.exception.SyntaxError('bad longitude hemisphere value') + + t = tok.get_string() + if t[-1] == 'm': + t = t[0 : -1] + altitude = float(t) * 100.0 # m -> cm + + token = tok.get().unescape() + if not token.is_eol_or_eof(): + value = token.value + if value[-1] == 'm': + value = value[0 : -1] + size = float(value) * 100.0 # m -> cm + token = tok.get().unescape() + if not token.is_eol_or_eof(): + value = token.value + if value[-1] == 'm': + value = value[0 : -1] + hprec = float(value) * 100.0 # m -> cm + token = tok.get().unescape() + if not token.is_eol_or_eof(): + value = token.value + if value[-1] == 'm': + value = value[0 : -1] + vprec = float(value) * 100.0 # m -> cm + tok.get_eol() + + return cls(rdclass, rdtype, latitude, longitude, altitude, + size, hprec, vprec) + + from_text = classmethod(from_text) + + def to_wire(self, file, compress = None, origin = None): + if self.latitude[0] < 0: + sign = -1 + degrees = long(-1 * self.latitude[0]) + else: + sign = 1 + degrees = long(self.latitude[0]) + milliseconds = (degrees * 3600000 + + self.latitude[1] * 60000 + + self.latitude[2] * 1000 + + self.latitude[3]) * sign + latitude = 0x80000000L + milliseconds + if self.longitude[0] < 0: + sign = -1 + degrees = long(-1 * self.longitude[0]) + else: + sign = 1 + degrees = long(self.longitude[0]) + milliseconds = (degrees * 3600000 + + self.longitude[1] * 60000 + + self.longitude[2] * 1000 + + self.longitude[3]) * sign + longitude = 0x80000000L + milliseconds + altitude = long(self.altitude) + 10000000L + size = _encode_size(self.size, "size") + hprec = _encode_size(self.horizontal_precision, "horizontal precision") + vprec = _encode_size(self.vertical_precision, "vertical precision") + wire = struct.pack("!BBBBIII", 0, size, hprec, vprec, latitude, + longitude, altitude) + file.write(wire) + + def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None): + (version, size, hprec, vprec, latitude, longitude, altitude) = \ + struct.unpack("!BBBBIII", wire[current : current + rdlen]) + if latitude > 0x80000000L: + latitude = float(latitude - 0x80000000L) / 3600000 + else: + latitude = -1 * float(0x80000000L - latitude) / 3600000 + if latitude < -90.0 or latitude > 90.0: + raise dns.exception.FormError("bad latitude") + if longitude > 0x80000000L: + longitude = float(longitude - 0x80000000L) / 3600000 + else: + longitude = -1 * float(0x80000000L - longitude) / 3600000 + if longitude < -180.0 or longitude > 180.0: + raise dns.exception.FormError("bad longitude") + altitude = float(altitude) - 10000000.0 + size = _decode_size(size, "size") + hprec = _decode_size(hprec, "horizontal precision") + vprec = _decode_size(vprec, "vertical precision") + return cls(rdclass, rdtype, latitude, longitude, altitude, + size, hprec, vprec) + + from_wire = classmethod(from_wire) + + def _cmp(self, other): + f = cStringIO.StringIO() + self.to_wire(f) + wire1 = f.getvalue() + f.seek(0) + f.truncate() + other.to_wire(f) + wire2 = f.getvalue() + f.close() + + return cmp(wire1, wire2) + + def _get_float_latitude(self): + return _tuple_to_float(self.latitude) + + def _set_float_latitude(self, value): + self.latitude = _float_to_tuple(value) + + float_latitude = property(_get_float_latitude, _set_float_latitude, + doc="latitude as a floating point value") + + def _get_float_longitude(self): + return _tuple_to_float(self.longitude) + + def _set_float_longitude(self, value): + self.longitude = _float_to_tuple(value) + + float_longitude = property(_get_float_longitude, _set_float_longitude, + doc="longitude as a floating point value") diff --git a/lib/dnspython/dns/rdtypes/ANY/MX.py b/lib/dnspython/dns/rdtypes/ANY/MX.py new file mode 100644 index 0000000000..9cad260672 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/MX.py @@ -0,0 +1,20 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.rdtypes.mxbase + +class MX(dns.rdtypes.mxbase.MXBase): + """MX record""" + pass diff --git a/lib/dnspython/dns/rdtypes/ANY/NS.py b/lib/dnspython/dns/rdtypes/ANY/NS.py new file mode 100644 index 0000000000..4b03a3ab47 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/NS.py @@ -0,0 +1,20 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.rdtypes.nsbase + +class NS(dns.rdtypes.nsbase.NSBase): + """NS record""" + pass diff --git a/lib/dnspython/dns/rdtypes/ANY/NSEC.py b/lib/dnspython/dns/rdtypes/ANY/NSEC.py new file mode 100644 index 0000000000..72859ce108 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/NSEC.py @@ -0,0 +1,141 @@ +# Copyright (C) 2004-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import cStringIO + +import dns.exception +import dns.rdata +import dns.rdatatype +import dns.name + +class NSEC(dns.rdata.Rdata): + """NSEC record + + @ivar next: the next name + @type next: dns.name.Name object + @ivar windows: the windowed bitmap list + @type windows: list of (window number, string) tuples""" + + __slots__ = ['next', 'windows'] + + def __init__(self, rdclass, rdtype, next, windows): + super(NSEC, self).__init__(rdclass, rdtype) + self.next = next + self.windows = windows + + def to_text(self, origin=None, relativize=True, **kw): + next = self.next.choose_relativity(origin, relativize) + text = '' + for (window, bitmap) in self.windows: + bits = [] + for i in xrange(0, len(bitmap)): + byte = ord(bitmap[i]) + for j in xrange(0, 8): + if byte & (0x80 >> j): + bits.append(dns.rdatatype.to_text(window * 256 + \ + i * 8 + j)) + text += (' ' + ' '.join(bits)) + return '%s%s' % (next, text) + + def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True): + next = tok.get_name() + next = next.choose_relativity(origin, relativize) + rdtypes = [] + while 1: + token = tok.get().unescape() + if token.is_eol_or_eof(): + break + nrdtype = dns.rdatatype.from_text(token.value) + if nrdtype == 0: + raise dns.exception.SyntaxError("NSEC with bit 0") + if nrdtype > 65535: + raise dns.exception.SyntaxError("NSEC with bit > 65535") + rdtypes.append(nrdtype) + rdtypes.sort() + window = 0 + octets = 0 + prior_rdtype = 0 + bitmap = ['\0'] * 32 + windows = [] + for nrdtype in rdtypes: + if nrdtype == prior_rdtype: + continue + prior_rdtype = nrdtype + new_window = nrdtype // 256 + if new_window != window: + windows.append((window, ''.join(bitmap[0:octets]))) + bitmap = ['\0'] * 32 + window = new_window + offset = nrdtype % 256 + byte = offset / 8 + bit = offset % 8 + octets = byte + 1 + bitmap[byte] = chr(ord(bitmap[byte]) | (0x80 >> bit)) + windows.append((window, ''.join(bitmap[0:octets]))) + return cls(rdclass, rdtype, next, windows) + + from_text = classmethod(from_text) + + def to_wire(self, file, compress = None, origin = None): + self.next.to_wire(file, None, origin) + for (window, bitmap) in self.windows: + file.write(chr(window)) + file.write(chr(len(bitmap))) + file.write(bitmap) + + def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None): + (next, cused) = dns.name.from_wire(wire[: current + rdlen], current) + current += cused + rdlen -= cused + windows = [] + while rdlen > 0: + if rdlen < 3: + raise dns.exception.FormError("NSEC too short") + window = ord(wire[current]) + octets = ord(wire[current + 1]) + if octets == 0 or octets > 32: + raise dns.exception.FormError("bad NSEC octets") + current += 2 + rdlen -= 2 + if rdlen < octets: + raise dns.exception.FormError("bad NSEC bitmap length") + bitmap = wire[current : current + octets] + current += octets + rdlen -= octets + windows.append((window, bitmap)) + if not origin is None: + next = next.relativize(origin) + return cls(rdclass, rdtype, next, windows) + + from_wire = classmethod(from_wire) + + def choose_relativity(self, origin = None, relativize = True): + self.next = self.next.choose_relativity(origin, relativize) + + def _cmp(self, other): + v = cmp(self.next, other.next) + if v == 0: + b1 = cStringIO.StringIO() + for (window, bitmap) in self.windows: + b1.write(chr(window)) + b1.write(chr(len(bitmap))) + b1.write(bitmap) + b2 = cStringIO.StringIO() + for (window, bitmap) in other.windows: + b2.write(chr(window)) + b2.write(chr(len(bitmap))) + b2.write(bitmap) + v = cmp(b1.getvalue(), b2.getvalue()) + return v diff --git a/lib/dnspython/dns/rdtypes/ANY/NSEC3.py b/lib/dnspython/dns/rdtypes/ANY/NSEC3.py new file mode 100644 index 0000000000..932d7b4032 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/NSEC3.py @@ -0,0 +1,182 @@ +# Copyright (C) 2004-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import base64 +import cStringIO +import string +import struct + +import dns.exception +import dns.rdata +import dns.rdatatype + +b32_hex_to_normal = string.maketrans('0123456789ABCDEFGHIJKLMNOPQRSTUV', + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567') +b32_normal_to_hex = string.maketrans('ABCDEFGHIJKLMNOPQRSTUVWXYZ234567', + '0123456789ABCDEFGHIJKLMNOPQRSTUV') + +# hash algorithm constants +SHA1 = 1 + +# flag constants +OPTOUT = 1 + +class NSEC3(dns.rdata.Rdata): + """NSEC3 record + + @ivar algorithm: the hash algorithm number + @type algorithm: int + @ivar flags: the flags + @type flags: int + @ivar iterations: the number of iterations + @type iterations: int + @ivar salt: the salt + @type salt: string + @ivar next: the next name hash + @type next: string + @ivar windows: the windowed bitmap list + @type windows: list of (window number, string) tuples""" + + __slots__ = ['algorithm', 'flags', 'iterations', 'salt', 'next', 'windows'] + + def __init__(self, rdclass, rdtype, algorithm, flags, iterations, salt, + next, windows): + super(NSEC3, self).__init__(rdclass, rdtype) + self.algorithm = algorithm + self.flags = flags + self.iterations = iterations + self.salt = salt + self.next = next + self.windows = windows + + def to_text(self, origin=None, relativize=True, **kw): + next = base64.b32encode(self.next).translate(b32_normal_to_hex).lower() + if self.salt == '': + salt = '-' + else: + salt = self.salt.encode('hex-codec') + text = '' + for (window, bitmap) in self.windows: + bits = [] + for i in xrange(0, len(bitmap)): + byte = ord(bitmap[i]) + for j in xrange(0, 8): + if byte & (0x80 >> j): + bits.append(dns.rdatatype.to_text(window * 256 + \ + i * 8 + j)) + text += (' ' + ' '.join(bits)) + return '%u %u %u %s %s%s' % (self.algorithm, self.flags, self.iterations, + salt, next, text) + + def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True): + algorithm = tok.get_uint8() + flags = tok.get_uint8() + iterations = tok.get_uint16() + salt = tok.get_string() + if salt == '-': + salt = '' + else: + salt = salt.decode('hex-codec') + next = tok.get_string().upper().translate(b32_hex_to_normal) + next = base64.b32decode(next) + rdtypes = [] + while 1: + token = tok.get().unescape() + if token.is_eol_or_eof(): + break + nrdtype = dns.rdatatype.from_text(token.value) + if nrdtype == 0: + raise dns.exception.SyntaxError("NSEC3 with bit 0") + if nrdtype > 65535: + raise dns.exception.SyntaxError("NSEC3 with bit > 65535") + rdtypes.append(nrdtype) + rdtypes.sort() + window = 0 + octets = 0 + prior_rdtype = 0 + bitmap = ['\0'] * 32 + windows = [] + for nrdtype in rdtypes: + if nrdtype == prior_rdtype: + continue + prior_rdtype = nrdtype + new_window = nrdtype // 256 + if new_window != window: + windows.append((window, ''.join(bitmap[0:octets]))) + bitmap = ['\0'] * 32 + window = new_window + offset = nrdtype % 256 + byte = offset / 8 + bit = offset % 8 + octets = byte + 1 + bitmap[byte] = chr(ord(bitmap[byte]) | (0x80 >> bit)) + windows.append((window, ''.join(bitmap[0:octets]))) + return cls(rdclass, rdtype, algorithm, flags, iterations, salt, next, windows) + + from_text = classmethod(from_text) + + def to_wire(self, file, compress = None, origin = None): + l = len(self.salt) + file.write(struct.pack("!BBHB", self.algorithm, self.flags, + self.iterations, l)) + file.write(self.salt) + l = len(self.next) + file.write(struct.pack("!B", l)) + file.write(self.next) + for (window, bitmap) in self.windows: + file.write(chr(window)) + file.write(chr(len(bitmap))) + file.write(bitmap) + + def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None): + (algorithm, flags, iterations, slen) = struct.unpack('!BBHB', + wire[current : current + 5]) + current += 5 + rdlen -= 5 + salt = wire[current : current + slen] + current += slen + rdlen -= slen + (nlen, ) = struct.unpack('!B', wire[current]) + current += 1 + rdlen -= 1 + next = wire[current : current + nlen] + current += nlen + rdlen -= nlen + windows = [] + while rdlen > 0: + if rdlen < 3: + raise dns.exception.FormError("NSEC3 too short") + window = ord(wire[current]) + octets = ord(wire[current + 1]) + if octets == 0 or octets > 32: + raise dns.exception.FormError("bad NSEC3 octets") + current += 2 + rdlen -= 2 + if rdlen < octets: + raise dns.exception.FormError("bad NSEC3 bitmap length") + bitmap = wire[current : current + octets] + current += octets + rdlen -= octets + windows.append((window, bitmap)) + return cls(rdclass, rdtype, algorithm, flags, iterations, salt, next, windows) + + from_wire = classmethod(from_wire) + + def _cmp(self, other): + b1 = cStringIO.StringIO() + self.to_wire(b1) + b2 = cStringIO.StringIO() + other.to_wire(b2) + return cmp(b1.getvalue(), b2.getvalue()) diff --git a/lib/dnspython/dns/rdtypes/ANY/NSEC3PARAM.py b/lib/dnspython/dns/rdtypes/ANY/NSEC3PARAM.py new file mode 100644 index 0000000000..ec91e5e85c --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/NSEC3PARAM.py @@ -0,0 +1,88 @@ +# Copyright (C) 2004-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import cStringIO +import struct + +import dns.exception +import dns.rdata + +class NSEC3PARAM(dns.rdata.Rdata): + """NSEC3PARAM record + + @ivar algorithm: the hash algorithm number + @type algorithm: int + @ivar flags: the flags + @type flags: int + @ivar iterations: the number of iterations + @type iterations: int + @ivar salt: the salt + @type salt: string""" + + __slots__ = ['algorithm', 'flags', 'iterations', 'salt'] + + def __init__(self, rdclass, rdtype, algorithm, flags, iterations, salt): + super(NSEC3PARAM, self).__init__(rdclass, rdtype) + self.algorithm = algorithm + self.flags = flags + self.iterations = iterations + self.salt = salt + + def to_text(self, origin=None, relativize=True, **kw): + if self.salt == '': + salt = '-' + else: + salt = self.salt.encode('hex-codec') + return '%u %u %u %s' % (self.algorithm, self.flags, self.iterations, salt) + + def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True): + algorithm = tok.get_uint8() + flags = tok.get_uint8() + iterations = tok.get_uint16() + salt = tok.get_string() + if salt == '-': + salt = '' + else: + salt = salt.decode('hex-codec') + return cls(rdclass, rdtype, algorithm, flags, iterations, salt) + + from_text = classmethod(from_text) + + def to_wire(self, file, compress = None, origin = None): + l = len(self.salt) + file.write(struct.pack("!BBHB", self.algorithm, self.flags, + self.iterations, l)) + file.write(self.salt) + + def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None): + (algorithm, flags, iterations, slen) = struct.unpack('!BBHB', + wire[current : current + 5]) + current += 5 + rdlen -= 5 + salt = wire[current : current + slen] + current += slen + rdlen -= slen + if rdlen != 0: + raise dns.exception.FormError + return cls(rdclass, rdtype, algorithm, flags, iterations, salt) + + from_wire = classmethod(from_wire) + + def _cmp(self, other): + b1 = cStringIO.StringIO() + self.to_wire(b1) + b2 = cStringIO.StringIO() + other.to_wire(b2) + return cmp(b1.getvalue(), b2.getvalue()) diff --git a/lib/dnspython/dns/rdtypes/ANY/NXT.py b/lib/dnspython/dns/rdtypes/ANY/NXT.py new file mode 100644 index 0000000000..99ae9b9dff --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/NXT.py @@ -0,0 +1,99 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.exception +import dns.rdata +import dns.rdatatype +import dns.name + +class NXT(dns.rdata.Rdata): + """NXT record + + @ivar next: the next name + @type next: dns.name.Name object + @ivar bitmap: the type bitmap + @type bitmap: string + @see: RFC 2535""" + + __slots__ = ['next', 'bitmap'] + + def __init__(self, rdclass, rdtype, next, bitmap): + super(NXT, self).__init__(rdclass, rdtype) + self.next = next + self.bitmap = bitmap + + def to_text(self, origin=None, relativize=True, **kw): + next = self.next.choose_relativity(origin, relativize) + bits = [] + for i in xrange(0, len(self.bitmap)): + byte = ord(self.bitmap[i]) + for j in xrange(0, 8): + if byte & (0x80 >> j): + bits.append(dns.rdatatype.to_text(i * 8 + j)) + text = ' '.join(bits) + return '%s %s' % (next, text) + + def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True): + next = tok.get_name() + next = next.choose_relativity(origin, relativize) + bitmap = ['\x00', '\x00', '\x00', '\x00', + '\x00', '\x00', '\x00', '\x00', + '\x00', '\x00', '\x00', '\x00', + '\x00', '\x00', '\x00', '\x00' ] + while 1: + token = tok.get().unescape() + if token.is_eol_or_eof(): + break + if token.value.isdigit(): + nrdtype = int(token.value) + else: + nrdtype = dns.rdatatype.from_text(token.value) + if nrdtype == 0: + raise dns.exception.SyntaxError("NXT with bit 0") + if nrdtype > 127: + raise dns.exception.SyntaxError("NXT with bit > 127") + i = nrdtype // 8 + bitmap[i] = chr(ord(bitmap[i]) | (0x80 >> (nrdtype % 8))) + bitmap = dns.rdata._truncate_bitmap(bitmap) + return cls(rdclass, rdtype, next, bitmap) + + from_text = classmethod(from_text) + + def to_wire(self, file, compress = None, origin = None): + self.next.to_wire(file, None, origin) + file.write(self.bitmap) + + def to_digestable(self, origin = None): + return self.next.to_digestable(origin) + self.bitmap + + def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None): + (next, cused) = dns.name.from_wire(wire[: current + rdlen], current) + current += cused + rdlen -= cused + bitmap = wire[current : current + rdlen] + if not origin is None: + next = next.relativize(origin) + return cls(rdclass, rdtype, next, bitmap) + + from_wire = classmethod(from_wire) + + def choose_relativity(self, origin = None, relativize = True): + self.next = self.next.choose_relativity(origin, relativize) + + def _cmp(self, other): + v = cmp(self.next, other.next) + if v == 0: + v = cmp(self.bitmap, other.bitmap) + return v diff --git a/lib/dnspython/dns/rdtypes/ANY/PTR.py b/lib/dnspython/dns/rdtypes/ANY/PTR.py new file mode 100644 index 0000000000..6c4b79eaac --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/PTR.py @@ -0,0 +1,20 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.rdtypes.nsbase + +class PTR(dns.rdtypes.nsbase.NSBase): + """PTR record""" + pass diff --git a/lib/dnspython/dns/rdtypes/ANY/RP.py b/lib/dnspython/dns/rdtypes/ANY/RP.py new file mode 100644 index 0000000000..421ce8e207 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/RP.py @@ -0,0 +1,86 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.exception +import dns.rdata +import dns.name + +class RP(dns.rdata.Rdata): + """RP record + + @ivar mbox: The responsible person's mailbox + @type mbox: dns.name.Name object + @ivar txt: The owner name of a node with TXT records, or the root name + if no TXT records are associated with this RP. + @type txt: dns.name.Name object + @see: RFC 1183""" + + __slots__ = ['mbox', 'txt'] + + def __init__(self, rdclass, rdtype, mbox, txt): + super(RP, self).__init__(rdclass, rdtype) + self.mbox = mbox + self.txt = txt + + def to_text(self, origin=None, relativize=True, **kw): + mbox = self.mbox.choose_relativity(origin, relativize) + txt = self.txt.choose_relativity(origin, relativize) + return "%s %s" % (str(mbox), str(txt)) + + def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True): + mbox = tok.get_name() + txt = tok.get_name() + mbox = mbox.choose_relativity(origin, relativize) + txt = txt.choose_relativity(origin, relativize) + tok.get_eol() + return cls(rdclass, rdtype, mbox, txt) + + from_text = classmethod(from_text) + + def to_wire(self, file, compress = None, origin = None): + self.mbox.to_wire(file, None, origin) + self.txt.to_wire(file, None, origin) + + def to_digestable(self, origin = None): + return self.mbox.to_digestable(origin) + \ + self.txt.to_digestable(origin) + + def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None): + (mbox, cused) = dns.name.from_wire(wire[: current + rdlen], + current) + current += cused + rdlen -= cused + if rdlen <= 0: + raise dns.exception.FormError + (txt, cused) = dns.name.from_wire(wire[: current + rdlen], + current) + if cused != rdlen: + raise dns.exception.FormError + if not origin is None: + mbox = mbox.relativize(origin) + txt = txt.relativize(origin) + return cls(rdclass, rdtype, mbox, txt) + + from_wire = classmethod(from_wire) + + def choose_relativity(self, origin = None, relativize = True): + self.mbox = self.mbox.choose_relativity(origin, relativize) + self.txt = self.txt.choose_relativity(origin, relativize) + + def _cmp(self, other): + v = cmp(self.mbox, other.mbox) + if v == 0: + v = cmp(self.txt, other.txt) + return v diff --git a/lib/dnspython/dns/rdtypes/ANY/RRSIG.py b/lib/dnspython/dns/rdtypes/ANY/RRSIG.py new file mode 100644 index 0000000000..0e4816f648 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/RRSIG.py @@ -0,0 +1,20 @@ +# Copyright (C) 2004-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.rdtypes.sigbase + +class RRSIG(dns.rdtypes.sigbase.SIGBase): + """RRSIG record""" + pass diff --git a/lib/dnspython/dns/rdtypes/ANY/RT.py b/lib/dnspython/dns/rdtypes/ANY/RT.py new file mode 100644 index 0000000000..1efd3724d9 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/RT.py @@ -0,0 +1,20 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.rdtypes.mxbase + +class RT(dns.rdtypes.mxbase.UncompressedDowncasingMX): + """RT record""" + pass diff --git a/lib/dnspython/dns/rdtypes/ANY/SIG.py b/lib/dnspython/dns/rdtypes/ANY/SIG.py new file mode 100644 index 0000000000..501e29cc8c --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/SIG.py @@ -0,0 +1,26 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.rdtypes.sigbase + +class SIG(dns.rdtypes.sigbase.SIGBase): + """SIG record""" + def to_digestable(self, origin = None): + return struct.pack('!HBBIIIH', self.type_covered, + self.algorithm, self.labels, + self.original_ttl, self.expiration, + self.inception, self.key_tag) + \ + self.signer.to_digestable(origin) + \ + self.signature diff --git a/lib/dnspython/dns/rdtypes/ANY/SOA.py b/lib/dnspython/dns/rdtypes/ANY/SOA.py new file mode 100644 index 0000000000..5f74b8d384 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/SOA.py @@ -0,0 +1,127 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import struct + +import dns.exception +import dns.rdata +import dns.name + +class SOA(dns.rdata.Rdata): + """SOA record + + @ivar mname: the SOA MNAME (master name) field + @type mname: dns.name.Name object + @ivar rname: the SOA RNAME (responsible name) field + @type rname: dns.name.Name object + @ivar serial: The zone's serial number + @type serial: int + @ivar refresh: The zone's refresh value (in seconds) + @type refresh: int + @ivar retry: The zone's retry value (in seconds) + @type retry: int + @ivar expire: The zone's expiration value (in seconds) + @type expire: int + @ivar minimum: The zone's negative caching time (in seconds, called + "minimum" for historical reasons) + @type minimum: int + @see: RFC 1035""" + + __slots__ = ['mname', 'rname', 'serial', 'refresh', 'retry', 'expire', + 'minimum'] + + def __init__(self, rdclass, rdtype, mname, rname, serial, refresh, retry, + expire, minimum): + super(SOA, self).__init__(rdclass, rdtype) + self.mname = mname + self.rname = rname + self.serial = serial + self.refresh = refresh + self.retry = retry + self.expire = expire + self.minimum = minimum + + def to_text(self, origin=None, relativize=True, **kw): + mname = self.mname.choose_relativity(origin, relativize) + rname = self.rname.choose_relativity(origin, relativize) + return '%s %s %d %d %d %d %d' % ( + mname, rname, self.serial, self.refresh, self.retry, + self.expire, self.minimum ) + + def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True): + mname = tok.get_name() + rname = tok.get_name() + mname = mname.choose_relativity(origin, relativize) + rname = rname.choose_relativity(origin, relativize) + serial = tok.get_uint32() + refresh = tok.get_ttl() + retry = tok.get_ttl() + expire = tok.get_ttl() + minimum = tok.get_ttl() + tok.get_eol() + return cls(rdclass, rdtype, mname, rname, serial, refresh, retry, + expire, minimum ) + + from_text = classmethod(from_text) + + def to_wire(self, file, compress = None, origin = None): + self.mname.to_wire(file, compress, origin) + self.rname.to_wire(file, compress, origin) + five_ints = struct.pack('!IIIII', self.serial, self.refresh, + self.retry, self.expire, self.minimum) + file.write(five_ints) + + def to_digestable(self, origin = None): + return self.mname.to_digestable(origin) + \ + self.rname.to_digestable(origin) + \ + struct.pack('!IIIII', self.serial, self.refresh, + self.retry, self.expire, self.minimum) + + def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None): + (mname, cused) = dns.name.from_wire(wire[: current + rdlen], current) + current += cused + rdlen -= cused + (rname, cused) = dns.name.from_wire(wire[: current + rdlen], current) + current += cused + rdlen -= cused + if rdlen != 20: + raise dns.exception.FormError + five_ints = struct.unpack('!IIIII', + wire[current : current + rdlen]) + if not origin is None: + mname = mname.relativize(origin) + rname = rname.relativize(origin) + return cls(rdclass, rdtype, mname, rname, + five_ints[0], five_ints[1], five_ints[2], five_ints[3], + five_ints[4]) + + from_wire = classmethod(from_wire) + + def choose_relativity(self, origin = None, relativize = True): + self.mname = self.mname.choose_relativity(origin, relativize) + self.rname = self.rname.choose_relativity(origin, relativize) + + def _cmp(self, other): + v = cmp(self.mname, other.mname) + if v == 0: + v = cmp(self.rname, other.rname) + if v == 0: + self_ints = struct.pack('!IIIII', self.serial, self.refresh, + self.retry, self.expire, self.minimum) + other_ints = struct.pack('!IIIII', other.serial, other.refresh, + other.retry, other.expire, + other.minimum) + v = cmp(self_ints, other_ints) + return v diff --git a/lib/dnspython/dns/rdtypes/ANY/SPF.py b/lib/dnspython/dns/rdtypes/ANY/SPF.py new file mode 100644 index 0000000000..9b5a9a9fed --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/SPF.py @@ -0,0 +1,22 @@ +# Copyright (C) 2006, 2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.rdtypes.txtbase + +class SPF(dns.rdtypes.txtbase.TXTBase): + """SPF record + + @see: RFC 4408""" + pass diff --git a/lib/dnspython/dns/rdtypes/ANY/SSHFP.py b/lib/dnspython/dns/rdtypes/ANY/SSHFP.py new file mode 100644 index 0000000000..bc54f5e260 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/SSHFP.py @@ -0,0 +1,77 @@ +# Copyright (C) 2005-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import struct + +import dns.rdata +import dns.rdatatype + +class SSHFP(dns.rdata.Rdata): + """SSHFP record + + @ivar algorithm: the algorithm + @type algorithm: int + @ivar fp_type: the digest type + @type fp_type: int + @ivar fingerprint: the fingerprint + @type fingerprint: string + @see: draft-ietf-secsh-dns-05.txt""" + + __slots__ = ['algorithm', 'fp_type', 'fingerprint'] + + def __init__(self, rdclass, rdtype, algorithm, fp_type, + fingerprint): + super(SSHFP, self).__init__(rdclass, rdtype) + self.algorithm = algorithm + self.fp_type = fp_type + self.fingerprint = fingerprint + + def to_text(self, origin=None, relativize=True, **kw): + return '%d %d %s' % (self.algorithm, + self.fp_type, + dns.rdata._hexify(self.fingerprint, + chunksize=128)) + + def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True): + algorithm = tok.get_uint8() + fp_type = tok.get_uint8() + fingerprint = tok.get_string() + fingerprint = fingerprint.decode('hex_codec') + tok.get_eol() + return cls(rdclass, rdtype, algorithm, fp_type, fingerprint) + + from_text = classmethod(from_text) + + def to_wire(self, file, compress = None, origin = None): + header = struct.pack("!BB", self.algorithm, self.fp_type) + file.write(header) + file.write(self.fingerprint) + + def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None): + header = struct.unpack("!BB", wire[current : current + 2]) + current += 2 + rdlen -= 2 + fingerprint = wire[current : current + rdlen] + return cls(rdclass, rdtype, header[0], header[1], fingerprint) + + from_wire = classmethod(from_wire) + + def _cmp(self, other): + hs = struct.pack("!BB", self.algorithm, self.fp_type) + ho = struct.pack("!BB", other.algorithm, other.fp_type) + v = cmp(hs, ho) + if v == 0: + v = cmp(self.fingerprint, other.fingerprint) + return v diff --git a/lib/dnspython/dns/rdtypes/ANY/TXT.py b/lib/dnspython/dns/rdtypes/ANY/TXT.py new file mode 100644 index 0000000000..23f4f3b7c6 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/TXT.py @@ -0,0 +1,20 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.rdtypes.txtbase + +class TXT(dns.rdtypes.txtbase.TXTBase): + """TXT record""" + pass diff --git a/lib/dnspython/dns/rdtypes/ANY/X25.py b/lib/dnspython/dns/rdtypes/ANY/X25.py new file mode 100644 index 0000000000..fc4790fe8a --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/X25.py @@ -0,0 +1,62 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import dns.exception +import dns.rdata +import dns.tokenizer + +class X25(dns.rdata.Rdata): + """X25 record + + @ivar address: the PSDN address + @type address: string + @see: RFC 1183""" + + __slots__ = ['address'] + + def __init__(self, rdclass, rdtype, address): + super(X25, self).__init__(rdclass, rdtype) + self.address = address + + def to_text(self, origin=None, relativize=True, **kw): + return '"%s"' % dns.rdata._escapify(self.address) + + def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True): + address = tok.get_string() + tok.get_eol() + return cls(rdclass, rdtype, address) + + from_text = classmethod(from_text) + + def to_wire(self, file, compress = None, origin = None): + l = len(self.address) + assert l < 256 + byte = chr(l) + file.write(byte) + file.write(self.address) + + def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None): + l = ord(wire[current]) + current += 1 + rdlen -= 1 + if l != rdlen: + raise dns.exception.FormError + address = wire[current : current + l] + return cls(rdclass, rdtype, address) + + from_wire = classmethod(from_wire) + + def _cmp(self, other): + return cmp(self.address, other.address) diff --git a/lib/dnspython/dns/rdtypes/ANY/__init__.py b/lib/dnspython/dns/rdtypes/ANY/__init__.py new file mode 100644 index 0000000000..0815dd5450 --- /dev/null +++ b/lib/dnspython/dns/rdtypes/ANY/__init__.py @@ -0,0 +1,48 @@ +# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +"""Class ANY (generic) rdata type classes.""" + +__all__ = [ + 'AFSDB', + 'CERT', + 'CNAME', + 'DLV', + 'DNAME', + 'DNSKEY', + 'DS', + 'GPOS', + 'HINFO', + 'HIP', + 'ISDN', + 'KEY', + 'LOC', + 'MX', + 'NS', + 'NSEC', + 'NSEC3', + 'NSEC3PARAM', + 'NXT', + 'PTR', + 'RP', + 'RRSIG', + 'RT', + 'SIG', + 'SOA', + 'SPF', + 'SSHFP', + 'TXT', + 'X25', +] -- cgit