1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """MX-like base classes."""
17
18 import cStringIO
19 import struct
20
21 import dns.exception
22 import dns.rdata
23 import dns.name
24
26 """Base class for rdata that is like an MX record.
27
28 @ivar preference: the preference value
29 @type preference: int
30 @ivar exchange: the exchange name
31 @type exchange: dns.name.Name object"""
32
33 __slots__ = ['preference', 'exchange']
34
35 - def __init__(self, rdclass, rdtype, preference, exchange):
39
40 - def to_text(self, origin=None, relativize=True, **kw):
43
44 - def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
50
51 from_text = classmethod(from_text)
52
53 - def to_wire(self, file, compress = None, origin = None):
57
61
62 - def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
73
74 from_wire = classmethod(from_wire)
75
78
80 """Base class for rdata that is like an MX record, but whose name
81 is not compressed when converted to DNS wire format, and whose
82 digestable form is not downcased."""
83
84 - def to_wire(self, file, compress = None, origin = None):
86
88 f = cStringIO.StringIO()
89 self.to_wire(f, None, origin)
90 return f.getvalue()
91
93 """Base class for rdata that is like an MX record, but whose name
94 is not compressed when convert to DNS wire format."""
95
96 - def to_wire(self, file, compress = None, origin = None):
98