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