1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 """MX-like base classes."""
19
20 from io import BytesIO
21 import struct
22
23 import dns.exception
24 import dns.rdata
25 import dns.name
26
27
28 -class MXBase(dns.rdata.Rdata):
29
30 """Base class for rdata that is like an MX record.
31
32 @ivar preference: the preference value
33 @type preference: int
34 @ivar exchange: the exchange name
35 @type exchange: dns.name.Name object"""
36
37 __slots__ = ['preference', 'exchange']
38
39 - def __init__(self, rdclass, rdtype, preference, exchange):
43
44 - def to_text(self, origin=None, relativize=True, **kw):
47
48 @classmethod
49 - def from_text(cls, rdclass, rdtype, tok, origin=None, relativize=True):
55
56 - def to_wire(self, file, compress=None, origin=None):
60
64
65 @classmethod
66 - def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
77
80
83
84 """Base class for rdata that is like an MX record, but whose name
85 is not compressed when converted to DNS wire format, and whose
86 digestable form is not downcased."""
87
88 - def to_wire(self, file, compress=None, origin=None):
90
92 f = BytesIO()
93 self.to_wire(f, None, origin)
94 return f.getvalue()
95
98
99 """Base class for rdata that is like an MX record, but whose name
100 is not compressed when convert to DNS wire format."""
101
102 - def to_wire(self, file, compress=None, origin=None):
104