1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """NS-like base classes."""
17
18 from io import BytesIO
19
20 import dns.exception
21 import dns.rdata
22 import dns.name
23
24
25 -class NSBase(dns.rdata.Rdata):
26
27 """Base class for rdata that is like an NS record.
28
29 @ivar target: the target name of the rdata
30 @type target: dns.name.Name object"""
31
32 __slots__ = ['target']
33
34 - def __init__(self, rdclass, rdtype, target):
37
38 - def to_text(self, origin=None, relativize=True, **kw):
41
42 @classmethod
43 - def from_text(cls, rdclass, rdtype, tok, origin=None, relativize=True):
48
49 - def to_wire(self, file, compress=None, origin=None):
51
54
55 @classmethod
56 - def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
64
67
70
71 """Base class for rdata that is like an NS record, but whose name
72 is not compressed when convert to DNS wire format, and whose
73 digestable form is not downcased."""
74
75 - def to_wire(self, file, compress=None, origin=None):
77
79 f = BytesIO()
80 self.to_wire(f, None, origin)
81 return f.getvalue()
82