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