Home | Trees | Indices | Help |
|
---|
|
1 # Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license 2 3 # Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. 4 # 5 # Permission to use, copy, modify, and distribute this software and its 6 # documentation for any purpose with or without fee is hereby granted, 7 # provided that the above copyright notice and this permission notice 8 # appear in all copies. 9 # 10 # THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES 11 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR 13 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 16 # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 18 import dns.rdtypes.mxbase 19 import struct22 23 """A record for Chaosnet 24 @ivar domain: the domain of the address 25 @type domain: dns.name.Name object 26 @ivar address: the 16-bit address 27 @type address: int""" 28 29 __slots__ = ['domain', 'address'] 307132 super(A, self).__init__(rdclass, rdtype, address, domain) 33 self.domain = domain 34 self.address = address3537 domain = self.domain.choose_relativity(origin, relativize) 38 return '%s %o' % (domain, self.address)39 40 @classmethod42 domain = tok.get_name() 43 address = tok.get_uint16(base=8) 44 domain = domain.choose_relativity(origin, relativize) 45 tok.get_eol() 46 return cls(rdclass, rdtype, address, domain)4749 self.domain.to_wire(file, compress, origin) 50 pref = struct.pack("!H", self.address) 51 file.write(pref)52 56 57 @classmethod59 (domain, cused) = dns.name.from_wire(wire[: current + rdlen-2], 60 current) 61 current += cused 62 (address,) = struct.unpack('!H', wire[current: current + 2]) 63 if cused+2 != rdlen: 64 raise dns.exception.FormError 65 if origin is not None: 66 domain = domain.relativize(origin) 67 return cls(rdclass, rdtype, address, domain)68
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Dec 8 10:59:56 2018 | http://epydoc.sourceforge.net |