diff options
| author | Bob Halley <halley@play-bow.org> | 2020-07-02 09:39:45 -0700 |
|---|---|---|
| committer | Bob Halley <halley@play-bow.org> | 2020-07-02 09:39:45 -0700 |
| commit | b5b51cdffbfcba0b11248303a6b4488ddd2ad41e (patch) | |
| tree | e2ba31e31ba653061f5a136fe229140db1aa17d4 | |
| parent | 7bca17f1e6655ff74fa284182dcc79e74aef9207 (diff) | |
| download | dnspython-b5b51cdffbfcba0b11248303a6b4488ddd2ad41e.tar.gz | |
port MXBase to parser
| -rw-r--r-- | dns/rdtypes/mxbase.py | 13 |
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) |
