HOPOPT - IPv6 Hop-by-Hop Options#
pcapkit.protocols.internet.hopopt contains
HOPOPT
only, which implements extractor for IPv6 Hop-by-Hop
Options header (HOPOPT) [*], whose structure is
described as below:
Octets |
Bits |
Name |
Description |
|---|---|---|---|
0 |
0 |
|
Next Header |
1 |
8 |
|
Header Extensive Length |
2 |
16 |
|
Options |
- class pcapkit.protocols.internet.hopopt.HOPOPT(file=None, length=None, **kwargs)#
Bases:
Internet[HOPOPT,HOPOPT]This class implements IPv6 Hop-by-Hop Options.
This class currently supports parsing of the following IPv6 Hop-by-Hop options, which are registered in the
self.__option__attribute:Option Code
Option Parser
Option Constructor
- Parameters:
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type:
Self
- property name: Literal['IPv6 Hop-by-Hop Options']#
Name of current protocol.
- property payload: Protocol | NoReturn#
Payload of current instance.
- Raises:
UnsupportedCall – if the protocol is used as an IPv6 extension header
- Return type:
- property protocol: str | None | NoReturn#
Name of next layer protocol (if any).
- Raises:
UnsupportedCall – if the protocol is used as an IPv6 extension header
- property protochain: ProtoChain | NoReturn#
Protocol chain of current instance.
- Raises:
UnsupportedCall – if the protocol is used as an IPv6 extension header
- classmethod register_option(code, meth)#
Register an option parser.
- read(length=None, *, extension=False, **kwargs)#
Read IPv6 Hop-by-Hop Options.
Structure of HOPOPT header [RFC 8200]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | . . . Options . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- make(next=TransType.UDP, next_default=None, next_namespace=None, next_reversed=False, options=None, payload=b'', **kwargs)#
Make (construct) packet data.
- Parameters:
next (Enum_TransType | StdlibEnum | AenumEnum | str | int) – Next header type.
next_default (Optional[int]) – Default value of next header type.
next_namespace (Optional[dict[str, int] | dict[int, str] | Type[StdlibEnum] | Type[AenumEnum]]) – Namespace of next header type.
next_reversed (bool) – If the namespace of next header type is reversed.
option – Hop-by-Hop Options.
payload (bytes | Protocol | Schema) – Payload of current protocol.
**kwargs (Any) – Arbitrary keyword arguments.
options (Optional[list[Schema_Option | tuple[Enum_Option, dict[str, Any]] | bytes] | Option]) –
- Return type:
Schema_HOPOPT
- Returns:
Constructed packet data.
- classmethod _make_data(data)#
Create key-value pairs from
datafor protocol construction.
- _read_hopopt_options(length)#
Read HOPOPT options.
- Positional arguments:
length: length of options
- Return type:
- Returns:
Extracted HOPOPT options
- Raises:
ProtocolError – If the threshold is NOT matching.
- Parameters:
length (int) –
- _read_opt_none(schema, option)#
Read HOPOPT unassigned options.
Structure of HOPOPT unassigned options [RFC 8200]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - | Option Type | Opt Data Len | Option Data +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
- Parameters:
schema (Schema_UnassignedOption) – parsed parameter schema
length – option length (incl. type, length, content)
option (Option) – extracted HOPOPT options
- Return type:
Data_UnassignedOption
- Returns:
Parsed option data.
- _read_opt_pad(schema, option)#
Read HOPOPT padding options.
Structure of HOPOPT padding options [RFC 8200]:
Pad1option:+-+-+-+-+-+-+-+-+ | 0 | +-+-+-+-+-+-+-+-+
PadNoption:+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - | 1 | Opt Data Len | Option Data +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
- Parameters:
schema (Schema_PadOption) – parsed parameter schema
option (Option) – extracted HOPOPT options
- Return type:
Data_PadOption
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
codeis NOT0or1.
- _read_opt_tun(schema, option)#
Read HOPOPT Tunnel Encapsulation Limit option.
Structure of HOPOPT Tunnel Encapsulation Limit option [RFC 2473]:
Option Type Opt Data Len Opt Data Len 0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0 0 0 0 0 1 0 0| 1 | Tun Encap Lim | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters:
schema (Schema_TunnelEncapsulationLimitOption) – parsed parameter schema
length – option length (incl. type, length, content)
option (Option) – extracted HOPOPT options
- Return type:
Data_TunnelEncapsulationLimitOption
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
hopopt.tun.lengthis NOT1.
- _read_opt_ra(schema, option)#
Read HOPOPT Router Alert option.
Structure of HOPOPT Router Alert option [RFC 2711]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0 0 0|0 0 1 0 1|0 0 0 0 0 0 1 0| Value (2 octets) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters:
schema (Schema_RouterAlertOption) – parsed parameter schema
length – option length (incl. type, length, content)
option (Option) – extracted HOPOPT options
- Return type:
Data_RouterAlertOption
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
hopopt.tun.lengthis NOT2.
- _read_opt_calipso(schema, option)#
Read HOPOPT Common Architecture Label IPv6 Security Option (CALIPSO) option.
Structure of HOPOPT CALIPSO option [RFC 5570]:
------------------------------------------------------------ | Next Header | Hdr Ext Len | Option Type | Option Length| +-------------+---------------+-------------+--------------+ | CALIPSO Domain of Interpretation | +-------------+---------------+-------------+--------------+ | Cmpt Length | Sens Level | Checksum (CRC-16) | +-------------+---------------+-------------+--------------+ | Compartment Bitmap (Optional; variable length) | +-------------+---------------+-------------+--------------+
- Parameters:
schema (Schema_CALIPSOOption) – parsed parameter schema
length – option length (incl. type, length, content)
option (Option) – extracted HOPOPT options
- Return type:
Data_CALIPSOOption
- Returns:
Parsed option data.
- Raises:
ProtocolError – If the option is malformed.
- _read_opt_smf_dpd(schema, option)#
Read HOPOPT Simplified Multicast Forwarding Duplicate Packet Detection (
SMF_DPD) option.Structure of HOPOPT
SMF_DPDoption [RFC 6621]:IPv6
SMF_DPDoption header in I-DPD (Identification-Based DPD) mode0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ... |0|0|0| 01000 | Opt. Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0|TidTy| TidLen| TaggerID (optional) ... | +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | Identifier ... +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+IPv6
SMF_DPDoption header in H-DPD (Hash-Based) mode0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ... |0|0|0| OptType | Opt. Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1| Hash Assist Value (HAV) ... +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters:
schema (Schema_SMFDPDOption) – parsed parameter schema
length – option length (incl. type, length, content)
option (Option) – extracted HOPOPT options
- Return type:
Data_SMFDPDOption
- Returns:
Parsed option data.
- Raises:
ProtocolError – If the option is malformed.
- _read_opt_pdm(schema, option)#
Read HOPOPT Performance and Diagnostic Metrics (PDM) option.
Structure of HOPOPT PDM option [RFC 8250]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Option Length | ScaleDTLR | ScaleDTLS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | PSN This Packet | PSN Last Received | |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Delta Time Last Received | Delta Time Last Sent | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters:
schema (Schema_PDMOption) – parsed parameter schema
length – option length (incl. type, length, content)
option (Option) – extracted HOPOPT options
- Return type:
Data_PDMOption
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
hopopt.pdm.lengthis NOT10.
- _read_opt_qs(schema, option)#
Read HOPOPT Quick Start option.
Structure of HOPOPT Quick-Start option [RFC 4782]:
A Quick-Start Request:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option | Length=6 | Func. | Rate | QS TTL | | | | 0000 |Request| | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | QS Nonce | R | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Report of Approved Rate:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option | Length=6 | Func. | Rate | Not Used | | | | 1000 | Report| | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | QS Nonce | R | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters:
schema (Schema_QuickStartOption) – parsed parameter schema
length – option length (incl. type, length, content)
option (Option) – extracted HOPOPT options
- Return type:
Data_QuickStartOption
- Returns:
Parsed option data.
- Raises:
ProtocolError – If the option is malformed.
- _read_opt_rpl(schema, option)#
Read HOPOPT Routing Protocol for Low-Power and Lossy Networks (RPL) option.
Structure of HOPOPT RPL option [RFC 6553]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Opt Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |O|R|F|0|0|0|0|0| RPLInstanceID | SenderRank | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | (sub-TLVs) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Parameters:
schema (Schema_RPLOption) – parsed parameter schema
length – option length (incl. type, length, content)
option (Option) – extracted HOPOPT options
- Return type:
Data_RPLOption
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
hopopt.rpl.lengthis NOT4.
- _read_opt_mpl(schema, option)#
Read HOPOPT Multicast Protocol for Low-Power and Lossy Networks (MPL) option.
Structure of HOPOPT MPL option [RFC 7731]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Opt Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | S |M|V| rsv | sequence | seed-id (optional) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Parameters:
schema (Schema_MPLOption) – parsed parameter schema
length – option length (incl. type, length, content)
option (Option) – extracted HOPOPT options
- Return type:
Data_MPLOption
- Returns:
Parsed option data.
- Raises:
ProtocolError – If the option is malformed.
- _read_opt_ilnp(schema, option)#
Read HOPOPT Identifier-Locator Network Protocol (ILNP) Nonce option.
Structure of HOPOPT ILNP Nonce option [RFC 6744]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | Option Type | Option Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / Nonce Value / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters:
schema (Schema_ILNPOption) – parsed parameter schema
length – option length (incl. type, length, content)
option (Option) – extracted HOPOPT options
- Return type:
Data_ILNPOption
- Returns:
Parsed option data.
- _read_opt_lio(schema, option)#
Read HOPOPT Line-Identification option.
Structure of HOPOPT Line-Identification option [RFC 6788]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Option Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LineIDLen | Line ID... +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Parameters:
schema (Schema_LineIdentificationOption) – parsed parameter schema
length – option length (incl. type, length, content)
option (Option) – extracted HOPOPT options
- Return type:
Data_LineIdentificationOption
- Returns:
Parsed option data.
- _read_opt_jumbo(schema, option)#
Read HOPOPT Jumbo Payload option.
Structure of HOPOPT Jumbo Payload option [RFC 2675]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Opt Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Jumbo Payload Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Parameters:
schema (Schema_JumboPayloadOption) – parsed parameter schema
length – option length (incl. type, length, content)
option (Option) – extracted HOPOPT options
- Return type:
Data_JumboPayloadOption
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
hopopt.jumbo.lengthis NOT4.
- _read_opt_home(schema, option)#
Read HOPOPT Home Address option.
Structure of HOPOPT Home Address option [RFC 6275]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Option Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Home Address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Parameters:
schema (Schema_HomeAddressOption) – parsed parameter schema
length – option length (incl. type, length, content)
option (Option) – extracted HOPOPT options
- Return type:
Data_HomeAddressOption
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
hopopt.jumbo.lengthis NOT16.
- _read_opt_ip_dff(schema, option)#
Read HOPOPT Depth-First Forwarding (
IP_DFF) option.Structure of HOPOPT
IP_DFFoption [RFC 6971]:1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | OptTypeDFF | OptDataLenDFF | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |VER|D|R|0|0|0|0| Sequence Number | Pad1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters:
schema (Schema_IPDFFOption) – parsed parameter schema
length – option length (incl. type, length, content)
option (Option) – extracted HOPOPT options
- Return type:
Data_IPDFFOption
- Returns:
Parsed option data.
- Raises:
ProtocolError – If
hopopt.ip_dff.lengthis NOT2.
- _make_hopopt_options(options)#
Make options for HOPOPT.
- _make_opt_none(code, opt=None, *, data=b'', **kwargs)#
Make HOPOPT unassigned option.
- Parameters:
- Return type:
- Returns:
Constructured option schema.
- _make_opt_pad(code, opt=None, *, length=0, **kwargs)#
Make HOPOPT pad option.
- _make_opt_tun(code, opt=None, *, limit=0, **kwargs)#
Make HOPOPT tunnel encapsulation limit option.
- Parameters:
code (
Option) – option type valueopt (
Optional[TunnelEncapsulationLimitOption]) – option datalimit (
int) – tunnel encapsulation limit**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructured option schema.
- _make_opt_ra(code, opt=None, *, alert=RouterAlert.Datagram_contains_a_Multicast_Listener_Discovery_message, alert_default=None, alert_namespace=None, alert_reversed=False, **kwargs)#
Make HOPOPT router alert option.
- Parameters:
code (
Option) – option type valueopt (
Optional[RouterAlertOption]) – option dataalert (
RouterAlert|IntEnum|IntEnum|str|int) – router alert valuealert_default (
Optional[int]) – default value of router alertalert_namespace (
Union[dict[str,int],dict[int,str],Type[IntEnum],Type[IntEnum],None]) – namespace of router alertalert_reversed (
bool) – reversed flag of router alert**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructured option schema.
- _make_opt_calipso(code, opt=None, *, domain=0, level=0, checksum=b'\\x00\\x00', bitmap=None, **kwargs)#
Make HOPOPT calipso option.
- Parameters:
- Return type:
- Returns:
Constructured option schema.
- _make_opt_smf_dpd(code, opt=None, *, mode=SMFDPDMode.I_DPD, mode_default=None, mode_namespace=None, mode_reversed=False, tid=None, id=b'', hav=b'', **kwargs)#
Make HOPOPT SMF DPD option.
- Parameters:
code (Enum_Option) – option type value
opt (Optional[Data_SMFIdentificationBasedDPDOption | Data_SMFHashBasedDPDOption]) – option data
mode (Enum_SMFDPDMode | StdlibEnum | AenumEnum | str | int) – DPD mode
mode_default (Optional[int]) – default value of DPD mode
mode_namespace (Optional[dict[str, int] | dict[int, str] | Type[StdlibEnum] | Type[AenumEnum]]) – namespace of DPD mode
mode_reversed (bool) – reversed flag of DPD mode
tid (Optional[bytes | IPv4Address | IPv6Address]) – Tagger ID
id (bytes) – identifier
hav (bytes) – hash assist value (HAV)
**kwargs (Any) – arbitrary keyword arguments
- Return type:
Schema_SMFDPDOption
- Returns:
Constructured option schema.
- _make_opt_pdm(code, opt=None, *, psntp=0, psnlr=0, deltatlr=0, deltatls=0, **kwargs)#
Make HOPOPT PDM option.
- Parameters:
code (
Option) – option type valuepsntp (
int) – packet sequence number (PSN) this packetpsnlr (
int) – packet sequence number (PSN) last receiveddeltatlr (
int) – delta time last received (in attoseconds)deltatls (
int) – delta time last sent (in attoseconds)**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructured option schema.
- _make_opt_qs(code, opt=None, *, func=QSFunction.Quick_Start_Request, func_default=None, func_namespace=None, func_reversed=False, rate=0, ttl=0, nonce=0, **kwargs)#
Make HOPOPT QS option.
- Parameters:
code (Enum_Option) – option type value
opt (Optional[Data_QuickStartOption]) – option data
func (Enum_QSFunction | StdlibEnum | AenumEnum | str | int) – QS function type
func_default (Optional[int]) – default value for QS function type
func_namespace (Optional[dict[str, int] | dict[int, str] | Type[StdlibEnum] | Type[AenumEnum]]) – namespace for QS function type
func_reversed (bool) – reversed flag for QS function type
rate (int) – rate (in kbps)
ttl (timedelta | int) – time to live (in seconds)
nonce (int) – nonce value
**kwargs (Any) – arbitrary keyword arguments
- Return type:
Schema_QuickStartOption
- Returns:
Constructured option schema.
- _make_opt_rpl(code, opt=None, *, down=False, rank_err=False, fwd_err=False, id=0, rank=0, **kwargs)#
Make HOPOPT RPL option.
- Parameters:
- Return type:
- Returns:
Constructured option schema.
- _make_opt_mpl(code, opt=None, *, max=False, drop=False, seq=0, seed=None, **kwargs)#
Make HOPOPT MPL option.
- Parameters:
- Return type:
- Returns:
Constructured option schema.
- _make_opt_ilnp(code, opt=None, *, nonce=0, **kwargs)#
Make HOPOPT ILNP option.
- Parameters:
code (
Option) – option type valueopt (
Optional[ILNPOption]) – option datanonce (
int) – ILNP nonce value**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructured option schema.
- _make_opt_lio(code, opt=None, *, id=b'', **kwargs)#
Make HOPOPT LIO option.
- Parameters:
code (
Option) – option type valueopt (
Optional[LineIdentificationOption]) – option dataid (
bytes) – line ID value**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructured option schema.
- _make_opt_jumbo(code, opt=None, *, len=0, **kwargs)#
Make HOPOPT Jumbo Payload option.
- Parameters:
code (
Option) – option type valueopt (
Optional[JumboPayloadOption]) – option datalen (
int) – jumbo payload length**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructured option schema.
- _make_opt_home(code, opt=None, *, addr='::', **kwargs)#
Make HOPOPT Home Address option.
- Parameters:
code (
Option) – option type valueopt (
Optional[HomeAddressOption]) – option dataaddr (
IPv6Address|str|bytes|int) – home address value**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructured option schema.
- _make_opt_ip_dff(code, opt=None, *, version=0, dup=False, ret=False, seq=0, **kwargs)#
Make HOPOPT IP DFF option.
- Parameters:
- Return type:
- Returns:
Constructured option schema.
- __option__: DefaultDict[Enum_Option | int, str | tuple[OptionParser, OptionConstructor]]#
DefaultDict[Enum_Option, str | tuple[OptionParser, OptionConstructor]]: Option code to method mapping, c.f.
_read_hopopt_options()and/or_make_hopopt_options(). Method names are expected to be referred to the class by_read_opt_${name}and/or_make_opt_${name}, and if such name not found, the value should then be a method that can parse the option by itself.
Header Schemas#
- class pcapkit.protocols.schema.internet.hopopt.HOPOPT(dict_=None, **kwargs)#
Bases:
SchemaHeader schema for HOPOPT packet.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- next: Enum_TransType = <EnumField next>#
Next header.
- options: list[Option] = <OptionField options>#
Options.
- class pcapkit.protocols.schema.internet.hopopt.Option(dict_=None, **kwargs)#
Bases:
SchemaHeader schema for HOPOPT options.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- type: Enum_Option = <EnumField type>#
Option type.
- len: int = <ConditionalField len>#
Option length (conditional in case of
Pad1option).
- class pcapkit.protocols.schema.internet.hopopt.UnassignedOption(dict_=None, **kwargs)#
Bases:
OptionHeader schema for HOPOPT unassigned options.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- class pcapkit.protocols.schema.internet.hopopt.PadOption(dict_=None, **kwargs)#
Bases:
OptionHeader schema for HOPOPT padding options.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- class pcapkit.protocols.schema.internet.hopopt.TunnelEncapsulationLimitOption(dict_=None, **kwargs)#
Bases:
OptionHeader schema for HOPOPT tunnel encapsulation limit options.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- class pcapkit.protocols.schema.internet.hopopt.RouterAlertOption(dict_=None, **kwargs)#
Bases:
OptionHeader schema for HOPOPT router alert options.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- class pcapkit.protocols.schema.internet.hopopt.CALIPSOOption(dict_=None, **kwargs)#
Bases:
OptionHeader schema for HOPOPT common architecture label IPv6 security options.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- domain: int = <UInt32Field domain>#
CALIPSO domain of interpretation.
- cmpt_len: int = <UInt8Field cmpt_len>#
Compartment length.
- level: int = <UInt8Field level>#
Sens level.
- checksum: bytes = <BytesField checksum>#
Checksum (CRC-16).
- bitmap: bytes = <ConditionalField bitmap>#
Compartment bitmap.
- class pcapkit.protocols.schema.internet.hopopt.SMFDPDOption(dict_=None, **kwargs)#
Bases:
OptionHeader schema for HOPOPT simplified multicast forwarding duplicate packet detection (
SMF_DPD) options.- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- class pcapkit.protocols.schema.internet.hopopt.SMFIdentificationBasedDPDOption(dict_=None, **kwargs)#
Bases:
SMFDPDOptionHeader schema for HOPOPT SMF identification-based DPD options.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- info: TaggerIDInfo = <BitField info>#
TaggerID information.
- tid: bytes | IPv4Address | IPv6Address = <ConditionalField tid>#
TaggerID.
- post_process(packet)#
Revise
schemadata after unpacking process.- Parameters:
- Return type:
- Returns:
Revised schema.
- class pcapkit.protocols.schema.internet.hopopt.SMFHashBasedDPDOption(dict_=None, **kwargs)#
Bases:
SMFDPDOptionHeader schema for HOPOPT SMF hash-based DPD options.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- hav: bytes = <BytesField hav>#
Hash assist value (HAV).
- post_process(packet)#
Revise
schemadata after unpacking process.- Parameters:
- Return type:
- Returns:
Revised schema.
- class pcapkit.protocols.schema.internet.hopopt.PDMOption(dict_=None, **kwargs)#
Bases:
OptionHeader schema for HOPOPT performance and diagnostic metrics (PDM) options.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- scaledtlr: int = <UInt8Field scaledtlr>#
Scale delta time last received (DTLR).
- scaledtls: int = <UInt8Field scaledtls>#
Scale delta time last sent (DTLS).
- psntp: int = <UInt16Field psntp>#
Packet sequence number (PSN) this packet.
- psnlr: int = <UInt16Field psnlr>#
Packet sequence number (PSN) last received.
- deltatlr: int = <UInt16Field deltatlr>#
Delta time last received (DTLR).
- class pcapkit.protocols.schema.internet.hopopt.QuickStartOption(dict_=None, **kwargs)#
Bases:
OptionHeader schema for HOPOPT quick start options.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- class pcapkit.protocols.schema.internet.hopopt.RPLOption(dict_=None, **kwargs)#
Bases:
OptionHeader schema for HOPOPT routing protocol for low-power and lossy networks (RPL) options.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- class pcapkit.protocols.schema.internet.hopopt.MPLOption(dict_=None, **kwargs)#
Bases:
OptionHeader schema for HOPOPT multicast protocol for low-power and lossy networks (MPL) options.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- seq: int = <UInt8Field seq>#
MPL sequence number.
- seed: int = <ConditionalField seed>#
MPL Seed-ID.
- pad: bytes = <PaddingField pad>#
Reserved data (padding).
- class pcapkit.protocols.schema.internet.hopopt.ILNPOption(dict_=None, **kwargs)#
Bases:
OptionHeader schema for HOPOPT identifier-locator network protocol (ILNP) options.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- class pcapkit.protocols.schema.internet.hopopt.LineIdentificationOption(dict_=None, **kwargs)#
Bases:
OptionHeader schema for HOPOPT line-identification options.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- id_len: int = <UInt8Field id_len>#
Line ID length.
- class pcapkit.protocols.schema.internet.hopopt.JumboPayloadOption(dict_=None, **kwargs)#
Bases:
OptionHeader schema for HOPOPT jumbo payload options.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- class pcapkit.protocols.schema.internet.hopopt.HomeAddressOption(dict_=None, **kwargs)#
Bases:
OptionHeader schema for HOPOPT home address options.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- class pcapkit.protocols.schema.internet.hopopt.IPDFFOption(dict_=None, **kwargs)#
Bases:
OptionHeader schema for HOPOPT depth-first forwarding (
IP_DFF) options.- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
Type Stubs#
Auxiliary Functions#
- pcapkit.protocols.schema.internet.hopopt.mpl_opt_seed_id_len(pkt)#
Return MPL Seed-ID length.
- pcapkit.protocols.schema.internet.hopopt.smf_dpd_data_selector(pkt)#
Selector function for
_SMFDPDOption.datafield.- Parameters:
- Return type:
- Returns:
If
modeis0, returns aSchemaFieldwrappedSMFIdentificationBasedDPDOptioninstance.If
modeis1, returns aSchemaFieldwrappedSMFHashBasedDPDOptioninstance.
- pcapkit.protocols.schema.internet.hopopt.smf_i_dpd_tid_selector(pkt)#
Selector function for
SMFIdentificationBasedDPDOption.tidfield.- Parameters:
- Return type:
- Returns:
If
tid_typeis0, returns aNoValueFieldinstance.If
tid_typeis1, returns aIPv4Fieldinstance.If
tid_typeis2, returns aIPv6Fieldinstance.Otherwise, returns a
BytesFieldinstance.
- pcapkit.protocols.schema.internet.hopopt.quick_start_data_selector(pkt)#
Selector function for
_QuickStartOption.datafield.
Data Models#
- class pcapkit.protocols.data.internet.hopopt.HOPOPT(*args, **kwargs)#
Bases:
DataData model for HOPOPT protocol.
- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- next: TransType#
Next header.
- length: int#
Header extension length.
- options: OrderedMultiDict[Enum_Option, Option]#
HOPOPT options.
- class pcapkit.protocols.data.internet.hopopt.Option(dict_=None, **kwargs)#
Bases:
DataData model for HOPOPT option data.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- type: Enum_Option#
Option type.
- action: OptionAction#
Unknown option cation.
- change: bool#
Change flag.
- length: int#
Content length.
- class pcapkit.protocols.data.internet.hopopt.UnassignedOption(*args, **kwargs)#
Bases:
OptionData model for HOPOPT unassigned option.
- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- data: bytes#
Option data.
- class pcapkit.protocols.data.internet.hopopt.PadOption(*args, **kwargs)#
Bases:
OptionData model for HOPOPT padding options.
- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- class pcapkit.protocols.data.internet.hopopt.TunnelEncapsulationLimitOption(*args, **kwargs)#
Bases:
OptionData model for HOPOPT tunnel encapsulation limit option.
- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- limit: int#
Tunnel encapsulation limit.
- class pcapkit.protocols.data.internet.hopopt.RouterAlertOption(*args, **kwargs)#
Bases:
OptionData model for HOPOPT router alter option.
- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- value: RouterAlert#
Router alter value.
- class pcapkit.protocols.data.internet.hopopt.CALIPSOOption(*args, **kwargs)#
Bases:
OptionData model for HOPOPT Common Architecture Label IPv6 Security Option (CALIPSO) option.
- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- domain: int#
CALIPSO domain of interpretation.
- cmpt_len: int#
Compartment length.
- level: int#
Sensitivity level.
- checksum: bytes#
Checksum.
- cmpt_bitmap: bytes#
Compartment bitmap.
- class pcapkit.protocols.data.internet.hopopt.SMFDPDOption(dict_=None, **kwargs)#
Bases:
OptionData model for HOPOPT Simplified Multicast Forwarding Duplicate Packet Detection (
SMF_DPD) option.- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- dpd_type: SMFDPDMode#
DPD type.
- class pcapkit.protocols.data.internet.hopopt.SMFIdentificationBasedDPDOption(*args, **kwargs)#
Bases:
SMFDPDOptionData model for HOPOPT I-DPD (Identification-Based DPD) option.
- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- tid_type: TaggerID#
TaggerID type.
- tid_len: int#
TaggerID length.
- tid: Optional[bytes | IPv4Address | IPv6Address]#
TaggerID.
- id: bytes#
Identifier.
- class pcapkit.protocols.data.internet.hopopt.SMFHashBasedDPDOption(*args, **kwargs)#
Bases:
SMFDPDOptionData model for HOPOPT H-DPD (Hash-Based DPD) option.
- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- hav: bytes#
Hash assist value.
- class pcapkit.protocols.data.internet.hopopt.PDMOption(*args, **kwargs)#
Bases:
OptionData model for HOPOPT Performance Diagnostic Metrics (PDM) option.
- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- scaledtlr: int#
Scale delta time last received.
- scaledtls: int#
Scale delta time last sent.
- psntp: int#
Packet sequence number this packet.
- psnlr: int#
Packet sequence number last received.
- deltatlr: int#
Delta time last received (in attoseconds).
- deltatls: int#
Delta time last sent (in attoseconds).
- class pcapkit.protocols.data.internet.hopopt.QuickStartOption(dict_=None, **kwargs)#
Bases:
OptionData model for HOPOPT Quick Start option.
- Parameters:
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type:
Self
- func: QSFunction#
QS function.
- rate: int#
Rate request/report.
- class pcapkit.protocols.data.internet.hopopt.RPLOption(*args, **kwargs)#
Bases:
OptionData model for HOPOPT Routing Protocol for Low-Power and Lossy Networks (RPL) option.
- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- flags: RPLFlags#
Flags.
- id: int#
RPL instance ID.
-
rank:
int
# Sender rank.
- class pcapkit.protocols.data.internet.hopopt.RPLFlags(*args, **kwargs)#
Bases:
DataData model for HOPOPT RPL option flags fields.
- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- down: bool#
Down flag.
- rank_err: bool#
Rank error flag.
- fwd_err: bool#
Forwarding error flag.
- class pcapkit.protocols.data.internet.hopopt.MPLOption(*args, **kwargs)#
Bases:
OptionData model for HOPOPT Multicast Protocol for Low-Power and Lossy Networks (MPL) option.
- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- seed_type: SeedID#
Seed length.
- flags: MPLFlags#
Flags.
- seq: int#
Sequence number.
- seed_id: Optional[int]#
Seed ID.
- class pcapkit.protocols.data.internet.hopopt.MPLFlags(*args, **kwargs)#
Bases:
DataData model for HOPOPT MPL option flags fields.
- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- max: bool#
Max flag.
- drop: bool#
Non-conformation flag.
- class pcapkit.protocols.data.internet.hopopt.ILNPOption(*args, **kwargs)#
Bases:
OptionData model for HOPOPT Identifier-Locator Network Protocol (ILNP) Nonce option.
- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- nonce: int#
Nonce value.
- class pcapkit.protocols.data.internet.hopopt.LineIdentificationOption(*args, **kwargs)#
Bases:
OptionData model for HOPOPT Line-Identification option.
- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- line_id_len: int#
Line ID length.
- line_id: bytes#
Line ID.
- class pcapkit.protocols.data.internet.hopopt.JumboPayloadOption(*args, **kwargs)#
Bases:
OptionData model for Jumbo Payload option.
- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- jumbo_len: int#
Jumbo payload length.
- class pcapkit.protocols.data.internet.hopopt.HomeAddressOption(*args, **kwargs)#
Bases:
OptionData model for HOPOPT Home Address option.
- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- address: IPv6Address#
Home address.
- class pcapkit.protocols.data.internet.hopopt.IPDFFOption(*args, **kwargs)#
Bases:
OptionData model for HOPOPT Depth-First Forwarding (
IP_DFF) option.- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- version: int#
Version.
- flags: DFFFlags#
Flags.
- seq: int#
Sequence number.
- class pcapkit.protocols.data.internet.hopopt.DFFFlags(*args, **kwargs)#
Bases:
DataData model for HOPOPT
IP_DFFoption flags.- Parameters:
*args – Arbitrary positional arguments.
**kwargs – Arbitrary keyword arguments.
- dup: bool#
Duplicate flag.
- ret: bool#
Return flag.