diff options
author | Bob Halley <halley@play-bow.org> | 2020-07-02 08:23:52 -0700 |
---|---|---|
committer | Bob Halley <halley@dnspython.org> | 2020-07-02 15:11:08 -0700 |
commit | 8335194878d419c9698b33ea3d269068387b245d (patch) | |
tree | 619ca6dbff07153cac0584b9d84dc4b6af2c474a /dns/rdtypes/ANY/RP.py | |
parent | e2a4c0c6b188b48405bc6e0e7a71f3544f2e9af0 (diff) | |
download | dnspython-8335194878d419c9698b33ea3d269068387b245d.tar.gz |
Rework wire format processing.
Wire format data is now done via a dns.wire.Parser, which does all of the
bookkeeping and also provides convenience routines (e.g. get_uint16() or
get_name()).
Diffstat (limited to 'dns/rdtypes/ANY/RP.py')
-rw-r--r-- | dns/rdtypes/ANY/RP.py | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/dns/rdtypes/ANY/RP.py b/dns/rdtypes/ANY/RP.py index fa3aaac..7446de6 100644 --- a/dns/rdtypes/ANY/RP.py +++ b/dns/rdtypes/ANY/RP.py @@ -51,18 +51,7 @@ class RP(dns.rdata.Rdata): self.txt.to_wire(file, None, origin, canonicalize) @classmethod - def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None): - (mbox, cused) = dns.name.from_wire(wire[: current + rdlen], - current) - current += cused - rdlen -= cused - if rdlen <= 0: - raise dns.exception.FormError - (txt, cused) = dns.name.from_wire(wire[: current + rdlen], - current) - if cused != rdlen: - raise dns.exception.FormError - if origin is not None: - mbox = mbox.relativize(origin) - txt = txt.relativize(origin) + def from_wire_parser(cls, rdclass, rdtype, parser, origin=None): + mbox = parser.get_name(origin) + txt = parser.get_name(origin) return cls(rdclass, rdtype, mbox, txt) |