1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 import base64
17
18 import dns.exception
19 import dns.util
20
21 -class DHCID(dns.rdata.Rdata):
22 """DHCID record
23
24 @ivar data: the data (the content of the RR is opaque as far as the
25 DNS is concerned)
26 @type data: bytes
27 @see: RFC 4701"""
28
29 __slots__ = ['data']
30
31 - def __init__(self, rdclass, rdtype, data):
34
35 - def to_text(self, origin=None, relativize=True, **kw):
37
38 - def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
39 chunks = []
40 while 1:
41 t = tok.get().unescape()
42 if t.is_eol_or_eof():
43 break
44 if not t.is_identifier():
45 raise dns.exception.SyntaxError
46 chunks.append(t.value)
47 b64 = ''.join(chunks)
48 data = base64.b64decode(b64.encode('ascii'))
49 return cls(rdclass, rdtype, data)
50
51 from_text = classmethod(from_text)
52
53 - def to_wire(self, file, compress = None, origin = None):
55
56 - def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
59
60 from_wire = classmethod(from_wire)
61
62 - def _cmp(self, other):
64