]>
git.ipfire.org Git - thirdparty/pdns.git/blob - regression-tests.recursor-dnssec/paddingoption.py
9 class PaddingOption(dns
.edns
.Option
):
10 """Implementation of rfc7830.
13 def __init__(self
, numberOfBytes
):
14 super(PaddingOption
, self
).__init
__(12)
15 self
.numberOfBytes
= numberOfBytes
17 def to_wire(self
, file=None):
18 """Create EDNS packet as defined in rfc7830."""
21 file.write(bytes(self
.numberOfBytes
))
23 return bytes(self
.numberOfBytes
)
25 def from_wire(cls
, otype
, wire
, current
, olen
):
26 """Read EDNS packet as defined in rfc7830.
29 An instance of PaddingOption based on the EDNS packet
34 return cls(numberOfBytes
)
36 from_wire
= classmethod(from_wire
)
40 def from_wire_parser(cls
, otype
, parser
):
41 data
= parser
.get_remaining()
46 self
.__class
__.__name
__,
50 def __eq__(self
, other
):
51 if not isinstance(other
, PaddingOption
):
53 return self
.numberOfBytes
== numberOfBytes
55 def __ne__(self
, other
):
56 return not self
.__eq
__(other
)
59 dns
.edns
._type
_to
_class
[0x000C] = PaddingOption