1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """MX-like base classes."""
17
18 from io import BytesIO
19 import struct
20
21 import dns.exception
22 import dns.rdata
23 import dns.name
24
25
26 -class MXBase(dns.rdata.Rdata):
27
28 """Base class for rdata that is like an MX record.
29
30 @ivar preference: the preference value
31 @type preference: int
32 @ivar exchange: the exchange name
33 @type exchange: dns.name.Name object"""
34
35 __slots__ = ['preference', 'exchange']
36
37 - def __init__(self, rdclass, rdtype, preference, exchange):
41
42 - def to_text(self, origin=None, relativize=True, **kw):
45
46 @classmethod
47 - def from_text(cls, rdclass, rdtype, tok, origin=None, relativize=True):
53
54 - def to_wire(self, file, compress=None, origin=None):
58
62
63 @classmethod
64 - def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
75
78
81
82 """Base class for rdata that is like an MX record, but whose name
83 is not compressed when converted to DNS wire format, and whose
84 digestable form is not downcased."""
85
86 - def to_wire(self, file, compress=None, origin=None):
88
90 f = BytesIO()
91 self.to_wire(f, None, origin)
92 return f.getvalue()
93
96
97 """Base class for rdata that is like an MX record, but whose name
98 is not compressed when convert to DNS wire format."""
99
100 - def to_wire(self, file, compress=None, origin=None):
102