summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@play-bow.org>2020-07-02 09:39:45 -0700
committerBob Halley <halley@play-bow.org>2020-07-02 09:39:45 -0700
commitb5b51cdffbfcba0b11248303a6b4488ddd2ad41e (patch)
treee2ba31e31ba653061f5a136fe229140db1aa17d4
parent7bca17f1e6655ff74fa284182dcc79e74aef9207 (diff)
downloaddnspython-b5b51cdffbfcba0b11248303a6b4488ddd2ad41e.tar.gz
port MXBase to parser
-rw-r--r--dns/rdtypes/mxbase.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/dns/rdtypes/mxbase.py b/dns/rdtypes/mxbase.py
index 63fd869..eaab6b2 100644
--- a/dns/rdtypes/mxbase.py
+++ b/dns/rdtypes/mxbase.py
@@ -53,16 +53,9 @@ class MXBase(dns.rdata.Rdata):
self.exchange.to_wire(file, compress, origin, canonicalize)
@classmethod
- def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
- (preference, ) = struct.unpack('!H', wire[current: current + 2])
- current += 2
- rdlen -= 2
- (exchange, cused) = dns.name.from_wire(wire[: current + rdlen],
- current)
- if cused != rdlen:
- raise dns.exception.FormError
- if origin is not None:
- exchange = exchange.relativize(origin)
+ def from_parser(cls, rdclass, rdtype, parser, origin=None):
+ preference = parser.get_uint16()
+ exchange = parser.get_name(origin)
return cls(rdclass, rdtype, preference, exchange)