IPv6-Opts - Destination Options for IPv6#

pcapkit.protocols.internet.ipv6_opts contains IPv6_Opts only, which implements extractor for Destination Options for IPv6 (IPv6-Opts) [*], whose structure is described as below:

Octets

Bits

Name

Description

0

0

opt.next

Next Header

1

8

opt.length

Header Extensive Length

2

16

opt.options

Options

class pcapkit.protocols.internet.ipv6_opts.IPv6_Opts(file=None, length=None, **kwargs)[source]#

Bases: Internet[IPv6_Opts, IPv6_Opts]

This class implements Destination Options for IPv6.

This class currently supports parsing of the following IPv6 destination options, which are registered in the self.__option__ attribute:

property name: Literal['Destination Options for IPv6']#

Name of current protocol.

property length: int#

Header length of current protocol.

property payload: ProtocolBase | NoReturn#

Payload of current instance.

Raises:

UnsupportedCall – if the protocol is used as an IPv6 extension header

Return type:

pcapkit.protocols.protocol.Protocol

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)[source]#

Register an option parser.

Parameters:
Return type:

None

read(length=None, *, extension=False, **kwargs)[source]#

Read Destination Options for IPv6.

Structure of IPv6-Opts header [RFC 8200]:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Next Header  |  Hdr Ext Len  |                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
|                                                               |
.                                                               .
.                            Options                            .
.                                                               .
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
  • length (Optional[int]) – Length of packet data.

  • extension (bool) – If the packet is used as an IPv6 extension header.

  • **kwargs (Any) – Arbitrary keyword arguments.

Return type:

IPv6_Opts

Returns:

Parsed packet data.

make(next=TransType.UDP, next_default=None, next_namespace=None, next_reversed=False, options=None, payload=b'', **kwargs)[source]#

Make (construct) packet data.

Parameters:
Return type:

IPv6_Opts

Returns:

Constructed packet data.

classmethod _make_data(data)[source]#

Create key-value pairs from data for protocol construction.

Parameters:

data (IPv6_Opts) – protocol data

Return type:

dict[str, Any]

Returns:

Key-value pairs for protocol construction.

_read_ipv6_opts(length)[source]#

Read IPv6-Opts options.

Positional arguments:

length: length of options

Return type:

OrderedMultiDict[Option, Option]

Returns:

Extracted IPv6-Opts options

Raises:

ProtocolError – If the threshold is NOT matching.

_read_opt_none(schema, option)[source]#

Read IPv6-Opts unassigned options.

Structure of IPv6-Opts unassigned options [RFC 8200]:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
|  Option Type  |  Opt Data Len |  Option Data
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
Parameters:
Return type:

UnassignedOption

Returns:

Parsed option data.

_read_opt_pad(schema, option)[source]#

Read IPv6-Opts padding options.

Structure of IPv6-Opts padding options [RFC 8200]:

  • Pad1 option:

    +-+-+-+-+-+-+-+-+
    |       0       |
    +-+-+-+-+-+-+-+-+
    
  • PadN option:

    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
    |       1       |  Opt Data Len |  Option Data
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
    
Parameters:
Return type:

PadOption

Returns:

Parsed option data.

Raises:

ProtocolError – If code is NOT 0 or 1.

_read_opt_tun(schema, option)[source]#

Read IPv6-Opts Tunnel Encapsulation Limit option.

Structure of IPv6-Opts 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:
Return type:

TunnelEncapsulationLimitOption

Returns:

Parsed option data.

Raises:

ProtocolError – If ipv6_opts.tun.length is NOT 1.

_read_opt_ra(schema, option)[source]#

Read IPv6-Opts Router Alert option.

Structure of IPv6-Opts 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:
Return type:

RouterAlertOption

Returns:

Parsed option data.

Raises:

ProtocolError – If ipv6_opts.tun.length is NOT 2.

_read_opt_calipso(schema, option)[source]#

Read IPv6-Opts Common Architecture Label IPv6 Security Option (CALIPSO) option.

Structure of IPv6-Opts 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:
Return type:

CALIPSOOption

Returns:

Parsed option data.

Raises:

ProtocolError – If the option is malformed.

_read_opt_smf_dpd(schema, option)[source]#

Read IPv6-Opts Simplified Multicast Forwarding Duplicate Packet Detection (SMF_DPD) option.

Structure of IPv6-Opts SMF_DPD option [RFC 6621]:

  • IPv6 SMF_DPD option header in I-DPD (Identification-Based DPD) mode

     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
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                   ...              |0|0|0|  01000  | Opt. Data Len |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |0|TidTy| TidLen|             TaggerID (optional) ...           |
    +-+-+-+-+-+-+-+-+               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                               |            Identifier  ...
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    
  • IPv6 SMF_DPD option header in H-DPD (Hash-Based) mode

     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
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                   ...              |0|0|0| OptType | Opt. Data Len |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |1|    Hash Assist Value (HAV) ...
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    
Parameters:
Return type:

SMFDPDOption

Returns:

Parsed option data.

Raises:

ProtocolError – If the option is malformed.

_read_opt_pdm(schema, option)[source]#

Read IPv6-Opts Performance and Diagnostic Metrics (PDM) option.

Structure of IPv6-Opts 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:
Return type:

PDMOption

Returns:

Parsed option data.

Raises:

ProtocolError – If ipv6_opts.pdm.length is NOT 10.

_read_opt_qs(schema, option)[source]#

Read IPv6-Opts Quick Start option.

Structure of IPv6-Opts 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:
Return type:

QuickStartOption

Returns:

Parsed option data.

Raises:

ProtocolError – If the option is malformed.

_read_opt_rpl(schema, option)[source]#

Read IPv6-Opts Routing Protocol for Low-Power and Lossy Networks (RPL) option.

Structure of IPv6-Opts 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:
Return type:

RPLOption

Returns:

Parsed option data.

Raises:

ProtocolError – If ipv6_opts.rpl.length is NOT 4.

_read_opt_mpl(schema, option)[source]#

Read IPv6-Opts Multicast Protocol for Low-Power and Lossy Networks (MPL) option.

Structure of IPv6-Opts 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:
Return type:

MPLOption

Returns:

Parsed option data.

Raises:

ProtocolError – If the option is malformed.

_read_opt_ilnp(schema, option)[source]#

Read IPv6-Opts Identifier-Locator Network Protocol (ILNP) Nonce option.

Structure of IPv6-Opts 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:
Return type:

ILNPOption

Returns:

Parsed option data.

_read_opt_lio(schema, option)[source]#

Read IPv6-Opts Line-Identification option.

Structure of IPv6-Opts 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:
Return type:

LineIdentificationOption

Returns:

Parsed option data.

_read_opt_jumbo(schema, option)[source]#

Read IPv6-Opts Jumbo Payload option.

Structure of IPv6-Opts Jumbo Payload option [RFC 2675]:

                                +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                                |  Option Type  |  Opt Data Len |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                     Jumbo Payload Length                      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

JumboPayloadOption

Returns:

Parsed option data.

Raises:

ProtocolError – If ipv6_opts.jumbo.length is NOT 4.

_read_opt_home(schema, option)[source]#

Read IPv6-Opts Home Address option.

Structure of IPv6-Opts 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:
Return type:

HomeAddressOption

Returns:

Parsed option data.

Raises:

ProtocolError – If ipv6_opts.jumbo.length is NOT 16.

_read_opt_ip_dff(schema, option)[source]#

Read IPv6-Opts Depth-First Forwarding (IP_DFF) option.

Structure of IPv6-Opts IP_DFF option [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:
Return type:

IPDFFOption

Returns:

Parsed option data.

Raises:

ProtocolError – If ipv6_opts.ip_dff.length is NOT 2.

_make_ipv6_opts(options)[source]#

Make options for IPv6-Opts.

Parameters:

option – IPv6-Opts options

Return type:

tuple[list[Option | bytes], int]

Returns:

Tuple of options and total length of options.

_make_opt_none(code, opt=None, *, data=b'', **kwargs)[source]#

Make IPv6-Opts unassigned option.

Parameters:
Return type:

UnassignedOption

Returns:

Constructured option schema.

_make_opt_pad(code, opt=None, *, length=0, **kwargs)[source]#

Make IPv6-Opts pad option.

Parameters:
  • code (Option) – option type value

  • opt (Optional[PadOption]) – option data

  • length (int) – padding length

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

PadOption

Returns:

Constructured option schema.

_make_opt_tun(code, opt=None, *, limit=0, **kwargs)[source]#

Make IPv6-Opts tunnel encapsulation limit option.

Parameters:
Return type:

TunnelEncapsulationLimitOption

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)[source]#

Make IPv6-Opts router alert option.

Parameters:
Return type:

RouterAlertOption

Returns:

Constructured option schema.

_make_opt_calipso(code, opt=None, *, domain=0, level=0, checksum=b'\\x00\\x00', bitmap=None, **kwargs)[source]#

Make IPv6-Opts calipso option.

Parameters:
  • code (Option) – option type value

  • opt (Optional[CALIPSOOption]) – option data

  • domain (int) – CALIPSO domain of interpretation

  • level (int) – sensitivity level

  • checksum (bytes) – checksum of the option

  • bitmap (Optional[bytes]) – compartment bitmap

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

CALIPSOOption

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)[source]#

Make IPv6-Opts SMF DPD option.

Parameters:
Return type:

SMFDPDOption

Returns:

Constructured option schema.

_make_opt_pdm(code, opt=None, *, psntp=0, psnlr=0, deltatlr=0, deltatls=0, **kwargs)[source]#

Make IPv6-Opts PDM option.

Parameters:
  • code (Option) – option type value

  • opt (Optional[PDMOption]) – option data

  • psntp (int) – packet sequence number (PSN) this packet

  • psnlr (int) – packet sequence number (PSN) last received

  • deltatlr (int) – delta time last received (in attoseconds)

  • deltatls (int) – delta time last sent (in attoseconds)

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

PDMOption

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)[source]#

Make IPv6-Opts QS option.

Parameters:
Return type:

QuickStartOption

Returns:

Constructured option schema.

_make_opt_rpl(code, opt=None, *, down=False, rank_err=False, fwd_err=False, id=0, rank=0, **kwargs)[source]#

Make IPv6-Opts RPL option.

Parameters:
  • code (Option) – option type value

  • opt (Optional[RPLOption]) – option data

  • down (bool) – down flag

  • rank_err (bool) – rank error flag

  • fwd_err (bool) – forwarding error flag

  • id (int) – RPL instance ID

  • rank (int) – sender rank

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

RPLOption

Returns:

Constructured option schema.

_make_opt_mpl(code, opt=None, *, max=False, drop=False, seq=0, seed=None, **kwargs)[source]#

Make IPv6-Opts MPL option.

Parameters:
  • code (Option) – option type value

  • opt (Optional[MPLOption]) – option data

  • max (bool) – maximum sequence number flag

  • drop (bool) – drop packet flag

  • seq (int) – MPL sequence number

  • seed (Optional[int]) – MPL seed ID

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

MPLOption

Returns:

Constructured option schema.

_make_opt_ilnp(code, opt=None, *, nonce=0, **kwargs)[source]#

Make IPv6-Opts ILNP option.

Parameters:
  • code (Option) – option type value

  • opt (Optional[ILNPOption]) – option data

  • nonce (int) – ILNP nonce value

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

ILNPOption

Returns:

Constructured option schema.

_make_opt_lio(code, opt=None, *, id=b'', **kwargs)[source]#

Make IPv6-Opts LIO option.

Parameters:
Return type:

LineIdentificationOption

Returns:

Constructured option schema.

_make_opt_jumbo(code, opt=None, *, len=0, **kwargs)[source]#

Make IPv6-Opts Jumbo Payload option.

Parameters:
Return type:

JumboPayloadOption

Returns:

Constructured option schema.

_make_opt_home(code, opt=None, *, addr='::', **kwargs)[source]#

Make IPv6-Opts Home Address option.

Parameters:
Return type:

HomeAddressOption

Returns:

Constructured option schema.

_make_opt_ip_dff(code, opt=None, *, version=0, dup=False, ret=False, seq=0, **kwargs)[source]#

Make IPv6-Opts IP DFF option.

Parameters:
  • code (Option) – option type value

  • opt (Optional[IPDFFOption]) – option data

  • version (int) – DFF version

  • dup (bool) – duplicate packet flag

  • ret (bool) – return packet flag

  • seq (int) – DFF sequence number

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

IPDFFOption

Returns:

Constructured option schema.

__option__: DefaultDict[Enum_Option | int, str | tuple[OptionParser, OptionConstructor]]#

Option code to method mapping, c.f. _read_ipv6_opts() and/or _make_ipv6_opts(). 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.

Type:

DefaultDict[Enum_Option, str | tuple[OptionParser, OptionConstructor]]

__post_init__(file=None, length=None, *, extension=False, **kwargs)[source]#

Post initialisation hook.

Parameters:
  • file (Union[IO[bytes], bytes, None]) – Source packet stream.

  • length (Optional[int]) – Length of packet data.

  • extension (bool) – If the protocol is used as an IPv6 extension header.

  • **kwargs (Any) – Arbitrary keyword arguments.

Return type:

None

See also

For construction argument, please refer to self.make.

classmethod __index__()[source]#

Numeral registry index of the protocol.

Return type:

TransType

Returns:

Numeral registry index of the protocol in IANA.

Header Schemas#

class pcapkit.protocols.schema.internet.ipv6_opts.IPv6_Opts(dict_=None, **kwargs)[source]#

Bases: Schema

Header schema for IPv6-Opts packet.

next: Enum_TransType = <EnumField next>#

Next header.

len: int = <UInt8Field len>#

Header length.

options: list[Option] = <OptionField options>#

Options.

payload: bytes = <PayloadField payload>#

Payload.

class pcapkit.protocols.schema.internet.ipv6_opts.Option(dict_=None, **kwargs)[source]#

Bases: EnumSchema[Option]

Header schema for IPv6-Opts options.

type: Enum_Option = <EnumField type>#

Option type.

len: int = <ConditionalField len>#

Option length (conditional in case of Pad1 option).

post_process(packet)[source]#

Revise schema data after unpacking process.

Parameters:

packet (dict[str, Any]) – Unpacked data.

Return type:

Schema

Returns:

Revised schema.

class pcapkit.protocols.schema.internet.ipv6_opts.UnassignedOption(dict_=None, **kwargs)[source]#

Bases: Option

Header schema for IPv6-Opts unassigned options.

data: bytes = <BytesField data>#

Option data.

class pcapkit.protocols.schema.internet.ipv6_opts.PadOption(dict_=None, **kwargs)[source]#

Bases: Option

Header schema for IPv6-Opts padding options.

pad: bytes = <PaddingField pad>#

Padding.

class pcapkit.protocols.schema.internet.ipv6_opts.TunnelEncapsulationLimitOption(dict_=None, **kwargs)[source]#

Bases: Option

Header schema for IPv6-Opts tunnel encapsulation limit options.

limit: int = <UInt8Field limit>#

Tunnel encapsulation limit.

class pcapkit.protocols.schema.internet.ipv6_opts.RouterAlertOption(dict_=None, **kwargs)[source]#

Bases: Option

Header schema for IPv6-Opts router alert options.

alert: Enum_RouterAlert = <EnumField alert>#

Router alert.

class pcapkit.protocols.schema.internet.ipv6_opts.CALIPSOOption(dict_=None, **kwargs)[source]#

Bases: Option

Header schema for IPv6-Opts common architecture label IPv6 security options.

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.

pad: bytes = <PaddingField pad>#

Padding.

class pcapkit.protocols.schema.internet.ipv6_opts.SMFDPDOption(dict_=None, **kwargs)[source]#

Bases: Option, EnumSchema[SMFDPDMode]

Header schema for IPv6-Opts simplified multicast forwarding duplicate packet detection (SMF_DPD) options.

class pcapkit.protocols.schema.internet.ipv6_opts.SMFIdentificationBasedDPDOption(dict_=None, **kwargs)[source]#

Bases: SMFDPDOption

Header schema for IPv6-Opts SMF identification-based DPD options.

info: TaggerIDInfo = <BitField info>#

TaggerID information.

tid: bytes | IPv4Address | IPv6Address = <ConditionalField tid>#

TaggerID.

id: bytes = <BytesField id>#

Identifier.

post_process(packet)[source]#

Revise schema data after unpacking process.

Parameters:

packet (dict[str, Any]) – Unpacked data.

Return type:

SMFIdentificationBasedDPDOption

Returns:

Revised schema.

class pcapkit.protocols.schema.internet.ipv6_opts.SMFHashBasedDPDOption(dict_=None, **kwargs)[source]#

Bases: SMFDPDOption

Header schema for IPv6-Opts SMF hash-based DPD options.

hav: bytes = <BytesField hav>#

Hash assist value (HAV).

post_process(packet)[source]#

Revise schema data after unpacking process.

Parameters:

packet (dict[str, Any]) – Unpacked data.

Return type:

SMFIdentificationBasedDPDOption

Returns:

Revised schema.

class pcapkit.protocols.schema.internet.ipv6_opts.PDMOption(dict_=None, **kwargs)[source]#

Bases: Option

Header schema for IPv6-Opts performance and diagnostic metrics (PDM) options.

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).

deltatls: int = <UInt16Field deltatls>#

Delta time last sent (DTLS).

class pcapkit.protocols.schema.internet.ipv6_opts._QuickStartOption(dict_=None, **kwargs)[source]#

Bases: Schema

Header schema for IPv6-Opts quick start options in generic representation.

flags: QSTestFlags = <ForwardMatchField flags>#

Flags.

data: QuickStartRequestOption | QuickStartReportOption = <SwitchField data>#

QS data.

post_process(packet)[source]#

Revise schema data after unpacking process.

Parameters:

packet (dict[str, Any]) – Unpacked data.

Return type:

QuickStartOption

Returns:

Revised schema.

class pcapkit.protocols.schema.internet.ipv6_opts.QuickStartOption(dict_=None, **kwargs)[source]#

Bases: Option, EnumSchema[QSFunction]

Header schema for IPv6-Opts quick start options.

flags: QuickStartFlags = <BitField flags>#

Flags.

class pcapkit.protocols.schema.internet.ipv6_opts.QuickStartRequestOption(dict_=None, **kwargs)[source]#

Bases: QuickStartOption

Header schema for IPv6-Opts quick start request options.

ttl: int = <UInt8Field ttl>#

QS time-to-live (TTL).

nonce: QSNonce = <BitField nonce>#

QS nonce.

class pcapkit.protocols.schema.internet.ipv6_opts.QuickStartReportOption(dict_=None, **kwargs)[source]#

Bases: QuickStartOption

Header schema for IPv6-Opts quick start report of approved rate options.

reserved: bytes = <PaddingField reserved>#

Reserved.

nonce: QSNonce = <BitField nonce>#

QS nonce.

class pcapkit.protocols.schema.internet.ipv6_opts.RPLOption(dict_=None, **kwargs)[source]#

Bases: Option

Header schema for IPv6-Opts routing protocol for low-power and lossy networks (RPL) options.

flags: RPLFlags = <BitField flags>#

Flags.

id: int = <UInt8Field id>#

RPL instance ID.

rank: int = <UInt16Field rank>#

Sender rank.

class pcapkit.protocols.schema.internet.ipv6_opts.RPLFlags[source]#

Bases: TypedDict

RPL flags.

down: int#

Down flag.

rank_err: int#

Rank error flag.

fwd_err: int#

Forwarding error flag.

class pcapkit.protocols.schema.internet.ipv6_opts.MPLOption(dict_=None, **kwargs)[source]#

Bases: Option

Header schema for IPv6-Opts multicast protocol for low-power and lossy networks (MPL) options.

flags: MPLFlags = <BitField flags>#

Flags.

seq: int = <UInt8Field seq>#

MPL sequence number.

seed: int = <ConditionalField seed>#

MPL Seed-ID.

pad: bytes = <PaddingField pad>#

Reserved data (padding).

post_process(packet)[source]#

Revise schema data after unpacking process.

Parameters:

packet (dict[str, Any]) – Unpacked data.

Return type:

Schema

Returns:

Revised schema.

class pcapkit.protocols.schema.internet.ipv6_opts.MPLFlags[source]#

Bases: TypedDict

MPL flags.

type: int#

Seed-ID type. Identifies the length of the Seed-ID.

max: int#

Max flag. 1 indicates that the value in the sequence field is known to be the largest sequence number that was received from the MPL Seed.

drop: int#

Verification flag. 0 indicates that the MPL Option conforms to this specification.

class pcapkit.protocols.schema.internet.ipv6_opts.ILNPOption(dict_=None, **kwargs)[source]#

Bases: Option

Header schema for IPv6-Opts identifier-locator network protocol (ILNP) options.

nonce: int = <NumberField nonce>#

Nonce value.

class pcapkit.protocols.schema.internet.ipv6_opts.LineIdentificationOption(dict_=None, **kwargs)[source]#

Bases: Option

Header schema for IPv6-Opts line-identification options.

id_len: int = <UInt8Field id_len>#

Line ID length.

id: bytes = <BytesField id>#

Line ID.

class pcapkit.protocols.schema.internet.ipv6_opts.JumboPayloadOption(dict_=None, **kwargs)[source]#

Bases: Option

Header schema for IPv6-Opts jumbo payload options.

jumbo_len: int = <UInt32Field jumbo_len>#

Jumbo payload length.

class pcapkit.protocols.schema.internet.ipv6_opts.HomeAddressOption(dict_=None, **kwargs)[source]#

Bases: Option

Header schema for IPv6-Opts home address options.

addr: IPv6Address = <IPv6AddressField addr>#

Home address.

class pcapkit.protocols.schema.internet.ipv6_opts.IPDFFOption(dict_=None, **kwargs)[source]#

Bases: Option

Header schema for IPv6-Opts depth-first forwarding (IP_DFF) options.

flags: DFFFlags = <BitField flags>#

Flags.

seq: int = <UInt16Field seq>#

Sequence number.

class pcapkit.protocols.schema.internet.ipv6_opts.DFFFlags[source]#

Bases: TypedDict

IP_DFF flags.

ver: int#

Version.

dup: int#

Duplicate flag.

ret: int#

Retune flag.

Type Stubs#

class pcapkit.protocols.schema.internet.ipv6_opts.TaggerIDInfo[source]#

Bases: TypedDict

TaggerID information.

mode: int#

SMF mode.

type: int#

TaggerID type.

len: int#

TaggerID length.

class pcapkit.protocols.schema.internet.ipv6_opts.QuickStartFlags[source]#

Bases: TypedDict

Quick-Start flags.

func: int#

QS function.

rate: int#

Rate request/report.

class pcapkit.protocols.schema.internet.ipv6_opts.RPLFlags[source]#

Bases: TypedDict

RPL flags.

down: int#

Down flag.

rank_err: int#

Rank error flag.

fwd_err: int#

Forwarding error flag.

class pcapkit.protocols.schema.internet.ipv6_opts.MPLFlags[source]#

Bases: TypedDict

MPL flags.

type: int#

Seed-ID type. Identifies the length of the Seed-ID.

max: int#

Max flag. 1 indicates that the value in the sequence field is known to be the largest sequence number that was received from the MPL Seed.

drop: int#

Verification flag. 0 indicates that the MPL Option conforms to this specification.

class pcapkit.protocols.schema.internet.ipv6_opts.DFFFlags[source]#

Bases: TypedDict

IP_DFF flags.

ver: int#

Version.

dup: int#

Duplicate flag.

ret: int#

Retune flag.

class pcapkit.protocols.schema.internet.ipv6_opts.SMFDPDTestFlag[source]#

Bases: TypedDict

SMF_DPD test flag.

len: int#

Length.

mode: int#

DPD mode.

class pcapkit.protocols.schema.internet.ipv6_opts.QSTestFlags[source]#

Bases: TypedDict

Quick start test flag.

func: int#

QS function.

class pcapkit.protocols.schema.internet.ipv6_opts.QSNonce[source]#

Bases: TypedDict

Quick start nonce.

nonce: int#

Nonce.

Auxiliary Functions#

pcapkit.protocols.schema.internet.ipv6_opts.mpl_opt_seed_id_len(pkt)[source]#

Return MPL Seed-ID length.

Parameters:

pkt (dict[str, Any]) – MPL option unpacked schema.

Return type:

int

Returns:

MPL Seed-ID length.

pcapkit.protocols.schema.internet.ipv6_opts.smf_dpd_data_selector(pkt)[source]#

Selector function for _SMFDPDOption.data field.

Parameters:

pkt (dict[str, Any]) – Packet data.

Return type:

FieldBase

Returns:

pcapkit.protocols.schema.internet.ipv6_opts.smf_i_dpd_tid_selector(pkt)[source]#

Selector function for SMFIdentificationBasedDPDOption.tid field.

Parameters:

pkt (dict[str, Any]) – Packet data.

Return type:

FieldBase

Returns:

pcapkit.protocols.schema.internet.ipv6_opts.quick_start_data_selector(pkt)[source]#

Selector function for _QuickStartOption.data field.

Parameters:

pkt (dict[str, Any]) – Packet data.

Return type:

FieldBase

Returns:

Data Models#

class pcapkit.protocols.data.internet.ipv6_opts.IPv6_Opts(*args: VT, **kwargs: VT)[source]#

Bases: Protocol

Data model for IPv6-Opts protocol.

next: TransType#

Next header.

length: int#

Header extension length.

options: OrderedMultiDict[Enum_Option, Option]#

IPv6-Opts options.

class pcapkit.protocols.data.internet.ipv6_opts.Option(dict_=None, **kwargs)[source]#

Bases: Data

Data model for IPv6-Opts option data.

type: Enum_Option#

Option type.

action: OptionAction#

Unknown option cation.

change: bool#

Change flag.

length: int#

Content length.

class pcapkit.protocols.data.internet.ipv6_opts.UnassignedOption(*args: VT, **kwargs: VT)[source]#

Bases: Option

Data model for IPv6-Opts unassigned option.

data: bytes#

Option data.

class pcapkit.protocols.data.internet.ipv6_opts.PadOption(*args: VT, **kwargs: VT)[source]#

Bases: Option

Data model for IPv6-Opts padding options.

class pcapkit.protocols.data.internet.ipv6_opts.TunnelEncapsulationLimitOption(*args: VT, **kwargs: VT)[source]#

Bases: Option

Data model for IPv6-Opts tunnel encapsulation limit option.

limit: int#

Tunnel encapsulation limit.

class pcapkit.protocols.data.internet.ipv6_opts.RouterAlertOption(*args: VT, **kwargs: VT)[source]#

Bases: Option

Data model for IPv6-Opts router alter option.

value: RouterAlert#

Router alter value.

class pcapkit.protocols.data.internet.ipv6_opts.CALIPSOOption(*args: VT, **kwargs: VT)[source]#

Bases: Option

Data model for IPv6-Opts Common Architecture Label IPv6 Security Option (CALIPSO) option.

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.ipv6_opts.SMFDPDOption(dict_=None, **kwargs)[source]#

Bases: Option

Data model for IPv6-Opts Simplified Multicast Forwarding Duplicate Packet Detection (SMF_DPD) option.

dpd_type: SMFDPDMode#

DPD type.

class pcapkit.protocols.data.internet.ipv6_opts.SMFIdentificationBasedDPDOption(*args: VT, **kwargs: VT)[source]#

Bases: SMFDPDOption

Data model for IPv6-Opts I-DPD (Identification-Based DPD) option.

tid_type: TaggerID#

TaggerID type.

tid_len: int#

TaggerID length.

tid: Optional[bytes | IPv4Address | IPv6Address]#

TaggerID.

id: bytes#

Identifier.

class pcapkit.protocols.data.internet.ipv6_opts.SMFHashBasedDPDOption(*args: VT, **kwargs: VT)[source]#

Bases: SMFDPDOption

Data model for IPv6-Opts H-DPD (Hash-Based DPD) option.

hav: bytes#

Hash assist value.

class pcapkit.protocols.data.internet.ipv6_opts.PDMOption(*args: VT, **kwargs: VT)[source]#

Bases: Option

Data model for IPv6-Opts Performance Diagnostic Metrics (PDM) option.

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.ipv6_opts.QuickStartOption(dict_=None, **kwargs)[source]#

Bases: Option

Data model for IPv6-Opts Quick Start option.

func: QSFunction#

QS function.

rate: int#

Rate request/report.

class pcapkit.protocols.data.internet.ipv6_opts.RPLOption(*args: VT, **kwargs: VT)[source]#

Bases: Option

Data model for IPv6-Opts Routing Protocol for Low-Power and Lossy Networks (RPL) option.

flags: RPLFlags#

Flags.

id: int#

RPL instance ID.

rank:

int

#

Sender rank.

class pcapkit.protocols.data.internet.ipv6_opts.RPLFlags(*args: VT, **kwargs: VT)[source]#

Bases: Data

Data model for IPv6-Opts RPL option flags fields.

down: bool#

Down flag.

rank_err: bool#

Rank error flag.

fwd_err: bool#

Forwarding error flag.

class pcapkit.protocols.data.internet.ipv6_opts.MPLOption(*args: VT, **kwargs: VT)[source]#

Bases: Option

Data model for IPv6-Opts Multicast Protocol for Low-Power and Lossy Networks (MPL) option.

seed_type: SeedID#

Seed length.

flags: MPLFlags#

Flags.

seq: int#

Sequence number.

seed_id: Optional[int]#

Seed ID.

class pcapkit.protocols.data.internet.ipv6_opts.MPLFlags(*args: VT, **kwargs: VT)[source]#

Bases: Data

Data model for IPv6-Opts MPL option flags fields.

max: bool#

Max flag.

drop: bool#

Non-conformation flag.

class pcapkit.protocols.data.internet.ipv6_opts.ILNPOption(*args: VT, **kwargs: VT)[source]#

Bases: Option

Data model for IPv6-Opts Identifier-Locator Network Protocol (ILNP) Nonce option.

nonce: int#

Nonce value.

class pcapkit.protocols.data.internet.ipv6_opts.LineIdentificationOption(*args: VT, **kwargs: VT)[source]#

Bases: Option

Data model for IPv6-Opts Line-Identification option.

line_id_len: int#

Line ID length.

line_id: bytes#

Line ID.

class pcapkit.protocols.data.internet.ipv6_opts.JumboPayloadOption(*args: VT, **kwargs: VT)[source]#

Bases: Option

Data model for Jumbo Payload option.

jumbo_len: int#

Jumbo payload length.

class pcapkit.protocols.data.internet.ipv6_opts.HomeAddressOption(*args: VT, **kwargs: VT)[source]#

Bases: Option

Data model for IPv6-Opts Home Address option.

address: IPv6Address#

Home address.

class pcapkit.protocols.data.internet.ipv6_opts.IPDFFOption(*args: VT, **kwargs: VT)[source]#

Bases: Option

Data model for IPv6-Opts Depth-First Forwarding (IP_DFF) option.

version: int#

Version.

seq: int#

Sequence number.

class pcapkit.protocols.data.internet.ipv6_opts.DFFFlags(*args: VT, **kwargs: VT)[source]#

Bases: Data

Data model for IPv6-Opts IP_DFF option flags.

dup: bool#

Duplicate flag.

ret: bool#

Return flag.

Footnotes