IPv6-Opts - Destination Options for IPv6

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

Octets

Bits

Name

Description

0

0

opts.next

Next Header

1

8

opts.length

Header Extension Length

2

16

opts.options

Options

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

Bases: IPv6_Ext[IPv6_Opts, IPv6_Opts]

This class implements Destination Options for IPv6.

This class parses the following IPv6 destination options, which are registered in the self.__option__ attribute:

Changed in version 1.5.0:

  • The ILNP nonce is sized with a ceiling rather than a floor (#601).

  • The RPL option keeps its reserved flag bits on rebuild and accepts RFC 6553 sub-TLVs (#1199).

  • A rebuild reproduces the option area byte for byte: its padding, a PadN with no data, the SMF_DPD, CALIPSO, PDM and ILNP Nonce options, and unassigned Quick-Start function codes (#1200, #1228, #1229, #1232 to #1234, #1237); a CALIPSO option keeps its trailing pad and its length (#1403).

  • The MPL, IP_DFF and Quick-Start options keep their reserved bits on rebuild, and IP_DFF takes the Opt Data Len of 3 that RFC 6971 Errata ID 3937 gives, where it took 2 (#1235).

  • A PadN option’s data and the “Not Used” octet of a Quick-Start report are kept as captured rather than zeroed (#1223).

Changed in version 1.6.0:

  • A Quick-Start rate the four-bit rate code cannot carry, or a TTL, nonce or reserved value outside its field, raises ProtocolError, rather than a bare ValueError, an OverflowError or a FieldValueError, or a different value written in its place (#2617).

  • The Quick-Start maker builds an unassigned function code as an unassigned option, the form the reader keeps one in (#2617).

  • An option maker given a value its fixed-width field cannot carry – negative, too wide, or a bool for a field wider than one bit – raises ProtocolError, rather than writing a different value or raising another exception; so does make() for options too long for the Hdr Ext Len (#2614).

  • A PDM scale, given or derived from its delta, that does not fit its octet raises ProtocolError, where it warned and was written wrapped (#2614).

  • Each enumeration field of make() and of the option makers, including the type of each option given to make(), takes a member or an int code, resolved with the enumeration’s get; a name, a bool for a field wider than one bit, or a code the field cannot carry raises ProtocolError, rather than resolving against an enumeration inferred from the caller’s frame, writing a different value or raising another exception (#2594).

  • The CALIPSO option’s checksum and the “Not Used” octet of a Quick-Start report, given the wrong number of octets, raise ProtocolError, rather than being padded or cut to their field (#2676).

  • An option given to make() as empty raw octets, which hold no type octet, raises ProtocolError rather than an IndexError (#2723).

Removed in version 1.6.0: The *_default, *_namespace and *_reversed arguments that went with each enumeration field of make() and of the option makers – next, alert, mode, tid_type, func and seed_type; resolve a name with resolve_index() first (#2594).

__option__: DefaultDict[Option | int, str | tuple[Callable[[Option, OrderedMultiDict[Option, Option]], Option], Callable[[Option, Option | None, Any], Option]]]

Option code to method mapping, see _read_ipv6_opts() and/or _make_ipv6_opts(). A str value names the methods _read_opt_${name} and _make_opt_${name}, falling back to _read_opt_none / _make_opt_none when they do not exist; any other value is a (parser, constructor) pair of callables.

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

Name of current protocol.

property alias: Literal['IPv6-Opts']

Acronym of corresponding 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

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

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 (int | None) – 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, options=None, payload=b'', *, len=None, **kwargs)[source]

Make (construct) packet data.

Parameters:
  • next (TransType | int) – Next header type.

  • options (list[Option | tuple[Option | int, dict[str, Any]] | bytes] | OrderedMultiDict[Option, Option] | None) – Destination Options.

  • payload (bytes | ProtocolBase | Schema) – Payload of current protocol.

  • len (int | None) – Hdr Ext Len to declare, rather than the one the options fill. A header the capture cut short declares one its parsed options do not fill, which from_data() passes on, so that the rebuild declares it too (#2694). Options that fill less than it declares are not padded out to it, so the header then declares more octets than it packs, as a cut one does.

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

Return type:

IPv6_Opts

Returns:

Constructed packet data.

Raises:

ProtocolError – If next, or the type of an option, is a name, a bool, or a member or code that does not fit in one octet; or if the options make a header too long for its one-octet Hdr Ext Len, or longer than len declares.

Changed in version 1.6.0: Takes len, the Hdr Ext Len of a header the capture cut short (#2694).

classmethod register_option(code, meth)[source]

Register an option parser.

Parameters:
Warns:

RegistryWarning – If a different entry is already registered for code; it is overwritten. Handing back the entry already stored, or one equal to it, is a silent no-op. The entry code shipped with is accepted like any other, so an override can be undone (#1362, #1363).

classmethod id()[source]

Index ID of the protocol.

Return type:

tuple[Literal['IPv6_Opts']]

Returns:

Index ID of the protocol.

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

Post initialisation hook.

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

  • length (int | None) – Length of packet data.

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

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

See also

For construction arguments, 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.

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.

Parameters:

length (int) – Length of the options area, in octets.

Return type:

OrderedMultiDict[Option, Option]

Returns:

Extracted IPv6-Opts options

Raises:

ProtocolError – If the parsed options do not total exactly length octets, unless the capture cut the header short, as its short read records. Or if the capture cut an option short and its parser refuses the zeros it lacks, or its maker does not write the octets captured back.

Changed in version 1.6.0: A header the capture cut short reads as the short read it is, and an option it cuts as its parser reads the zeros it lacks, rather than being refused (#2694).

_make_ipv6_opts(options)[source]

Make options for IPv6-Opts.

Parameters:

options (list[Option | tuple[Option | int, dict[str, Any]] | bytes] | OrderedMultiDict[Option, Option]) – IPv6-Opts options

Return type:

tuple[list[Option | bytes], int]

Returns:

Tuple of options and total length of options.

Raises:

ProtocolError – If the type of an option, given in a (type,     kwargs) pair or as the key of a container, is a name, a bool or a code its field cannot carry, or if an option given as raw octets is empty (#2723).

Note

Options given as a list are fresh input: padding options in it are dropped, and padding is inserted after each option to align the header. Options given as a mapping, such as the OrderedMultiInfo of parsed data, are emitted in order with their own padding options kept, and padding is added only at the end if the header is not aligned.

The returned length is that of the options area alone, the value make() derives the Hdr Ext Len field from. Since the two octets of the fixed header precede it, an options area is well formed only when it is 2 octets short of a multiple of 8 – including when it holds no real options at all, in which case it is 6 octets of pure padding rather than empty.

_read_opt_none(schema, *, options)[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, *, options)[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.

Note

A Pad1 option occupies a single octet and carries no Opt Data Len field, so its length is 1 rather than len + 2. That one-octet wire shape is enforced by PadOption itself, which sizes both the length octet and the padding data from the option type; clen is therefore always 0 here for a parsed Pad1, and the length check this method makes only guards a schema built by hand. A PadN whose Opt Data Len is 0 is a valid two-octet padding option [RFC 8200 Section 4.2].

_read_opt_tun(schema, *, options)[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 schema.len is NOT 1.

_read_opt_ra(schema, *, options)[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 schema.len is NOT 2.

_read_opt_calipso(schema, *, options)[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.

Note

Cmpt Length counts 32-bit words and may be odd [RFC 5570 Section 5.2]; it only has to fit inside Opt Data Len, which calipso_pad_len() has already checked while the option was unpacked.

_read_opt_smf_dpd(schema, *, options)[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, *, options)[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 schema.len is NOT 10.

_read_opt_rpl(schema, *, options)[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)                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

The sub-TLVs, which RFC 6553 Section 3 says MUST be skipped when unrecognised, are kept as raw octets in sub_tlvs.

Parameters:
Return type:

RPLOption

Returns:

Parsed option data.

Raises:

ProtocolError – If schema.len is less than 4.

_read_opt_qs(schema, *, options)[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.

Note

An option whose QS function is neither of the two above has no defined layout, so the schema keeps it as an unassigned option and it is parsed as one, see _read_opt_none(). That dispatch is by the schema’s own class, decided from the octets a file read hands it; a QuickStartRequestOption or QuickStartReportOption built directly with an unassigned func reaches this method regardless, which is why it still raises below rather than returning early.

_read_opt_mpl(schema, *, options)[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, *, options)[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, *, options)[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, *, options)[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 schema.len is NOT 4.

_read_opt_home(schema, *, options)[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 schema.len is NOT 16.

_read_opt_ip_dff(schema, *, options)[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     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

OptDataLenDFF is 3, the flags octet and the sequence number, as corrected by RFC 6971 Errata ID 3937; the RFC text says 2.

Parameters:
Return type:

IPDFFOption

Returns:

Parsed option data.

Raises:

ProtocolError – If schema.len is NOT 3.

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

Make IPv6-Opts unassigned option.

Parameters:
Return type:

UnassignedOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If data is too long for the one-octet Opt Data Len.

_make_opt_pad(code, opt=None, *, length=0, pad=b'', **kwargs)[source]

Make IPv6-Opts pad option.

Parameters:
  • code (Option) – option type value

  • opt (PadOption | None) – option data

  • length (int) – value of the Opt Data Len field, i.e. the number of padding octets after the two octets of the option header

  • pad (bytes) – the PadN option data, truncated or zero-filled to length octets

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

PadOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If length does not fit the one-octet Opt Data Len.

Warns:

ProtocolWarning – If code is Pad1 but length is not 0; a PadN option is made instead.

Note

Data_PadOption.length counts the whole option, whereas Schema_PadOption.len is the Opt Data Len field: two octets fewer, and absent altogether for a Pad1. opt is honoured so that re-making a parsed padding option keeps its type and size. A PadN with length 0 is a valid two-octet option [RFC 8200 Section 4.2] and is kept.

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

Make IPv6-Opts tunnel encapsulation limit option.

Parameters:
Return type:

TunnelEncapsulationLimitOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If limit does not fit in one octet.

_make_opt_ra(code, opt=None, *, alert=RouterAlert.Datagram_contains_a_Multicast_Listener_Discovery_message, **kwargs)[source]

Make IPv6-Opts router alert option.

Parameters:
Return type:

RouterAlertOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If the router alert value is a name, a bool, or a member or code that does not fit in two octets.

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

Make IPv6-Opts calipso option.

Parameters:
  • code (Option) – option type value

  • opt (CALIPSOOption | None) – option data

  • domain (int) – CALIPSO domain of interpretation

  • level (int) – sensitivity level

  • checksum (bytes) – checksum of the option

  • bitmap (bytes | tuple[int, ...] | None) – compartment bitmap, as a bytes-like object or as an iterable of octets, such as the tuple the reader stores; its length must be a multiple of 4 octets

  • pad (bytes) – octets after the compartment bitmap, counted in Opt Data Len

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

CALIPSOOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If domain or level does not fit its field, if checksum is not two octets, if the bitmap is not bytes-like or an iterable of octets, or is not a whole number of 32-bit words, if pad is not bytes, or if the option data would exceed the 255 octets Opt Data Len can count.

Note

Cmpt Length on the wire counts 32-bit words [RFC 5570 Section 5.1], whereas the bitmap here is sized in octets.

_make_opt_smf_dpd(code, opt=None, *, mode=SMFDPDMode.I_DPD, tid_type=None, tid=None, id=b'', hav=b'', **kwargs)[source]

Make IPv6-Opts SMF DPD option.

Parameters:
Return type:

SMFDPDOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If the DPD mode is a name, or a member or code that does not fit in one bit; if the TaggerID type is a name, a bool, or a member or code that does not fit in three bits; if the Tagger ID does not fit the TaggerID type, the H-DPD Hash Assist Value is empty, or the option data is too long for its one-octet Opt Data Len.

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

Make IPv6-Opts PDM option.

Parameters:
  • code (Option) – option type value

  • opt (PDMOption | None) – 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)

  • scaledtlr (int | None) – scale of delta time last received; derived from deltatlr if not given

  • scaledtls (int | None) – scale of delta time last sent; derived from deltatls if not given

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

PDMOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If psntp or psnlr does not fit in two octets, a scale does not fit in one octet, or a delta is negative or, at the scale given for it, does not fit two octets.

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

Make IPv6-Opts RPL option.

Parameters:
  • code (Option) – option type value

  • opt (RPLOption | None) – 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

  • reserved (int) – reserved flag bits, i.e. the low five bits of the flags octet

  • sub_tlvs (bytes) – sub-TLVs, as raw octets

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

RPLOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If reserved, id or rank does not fit its field, or sub_tlvs does not fit in the option.

_make_opt_qs(code, opt=None, *, func=QSFunction.Quick_Start_Request, rate=0, ttl=0, nonce=0, reserved=0, unused=b'\x00', **kwargs)[source]

Make IPv6-Opts QS option.

Parameters:
Return type:

QuickStartOption | UnassignedOption

Returns:

Constructed option schema. An unassigned option schema if opt is a Quick-Start option parsed as unassigned, see _read_opt_qs(), or if func is neither of the assigned functions, in which case the option data takes the layout of a Quick-Start Request.

Raises:

ProtocolError – If func is a name, a bool, or a member or code that does not fit in four bits, the rate code cannot carry rate, ttl, nonce or reserved does not fit its field, or unused is not one octet.

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

Make IPv6-Opts MPL option.

Parameters:
  • code (Option) – option type value

  • opt (MPLOption | None) – option data

  • seed_type (SeedID | int | None) – seed-id type (S field); inferred from seed if not given

  • max (bool) – maximum sequence number flag

  • drop (bool) – drop packet flag

  • reserved (int) – reserved bits (rsv), i.e. the low four bits of the flags octet

  • seq (int) – MPL sequence number

  • seed (int | IPv6Address | None) – MPL seed ID, ignored when the seed-id type is IPV6_SOURCE_ADDRESS, as the seed is then the IPv6 source address

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

MPLOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If the seed-id type is a name, a bool, or a member or code that does not fit in two bits; if the seed ID is missing or does not fit the seed-id type, or reserved or seq does not fit its field.

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

Make IPv6-Opts ILNP option.

Parameters:
  • code (Option) – option type value

  • opt (ILNPOption | None) – option data

  • nonce (int) – ILNP nonce value

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

ILNPOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If nonce is negative, or needs more octets than Opt Data Len can count.

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

Make IPv6-Opts LIO option.

Parameters:
Return type:

LineIdentificationOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If id is too long for the one-octet Opt Data Len.

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

Make IPv6-Opts Jumbo Payload option.

Parameters:
Return type:

JumboPayloadOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If len does not fit in four octets.

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

Make IPv6-Opts Home Address option.

Parameters:
Return type:

HomeAddressOption

Returns:

Constructed option schema.

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

Make IPv6-Opts IP DFF option.

Parameters:
  • code (Option) – option type value

  • opt (IPDFFOption | None) – option data

  • version (int) – DFF version

  • dup (bool) – duplicate packet flag

  • ret (bool) – return packet flag

  • reserved (int) – reserved bits, i.e. the low four bits of the flags octet

  • seq (int) – DFF sequence number

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

IPDFFOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If version, reserved or seq does not fit its field.

Header Schemas

Removed in version 1.6.0: pcapkit.protocols.schema.internet.ipv6_opts, with no alias: the module moved here (#2534).

class pcapkit.protocols.internet.ipv6_opts.schema.IPv6_Opts(next=NO_VALUE, len=NO_VALUE, options=NO_VALUE, payload=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Schema

Header schema for IPv6-Opts packet.

next: 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.internet.ipv6_opts.schema.Option(*args, **kwargs)[source]

Bases: EnumSchema[Option]

Header schema for IPv6-Opts options.

type: 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.internet.ipv6_opts.schema.UnassignedOption(type=NO_VALUE, len=NO_VALUE, data=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Option

Header schema for IPv6-Opts unassigned options.

data: bytes = <BytesField data>

Option data.

class pcapkit.protocols.internet.ipv6_opts.schema.PadOption(type=NO_VALUE, len=NO_VALUE, pad=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Option

Header schema for IPv6-Opts padding options.

The two padding options do not share a wire shape: a Pad1 option is a lone type octet, whereas a PadN option is a type octet, an Opt Data Len octet, and that many padding octets [RFC 8200 Section 4.2]. Both the Opt Data Len octet (Option.len) and the padding data (self.pad) are therefore sized from the option type, so that a Pad1 option consumes exactly one octet.

pad: bytes = <PaddingField pad>

Padding.

class pcapkit.protocols.internet.ipv6_opts.schema.TunnelEncapsulationLimitOption(type=NO_VALUE, len=NO_VALUE, limit=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Option

Header schema for IPv6-Opts tunnel encapsulation limit options.

limit: int = <UInt8Field limit>

Tunnel encapsulation limit.

class pcapkit.protocols.internet.ipv6_opts.schema.RouterAlertOption(type=NO_VALUE, len=NO_VALUE, alert=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Option

Header schema for IPv6-Opts router alert options.

alert: RouterAlert = <EnumField alert>

Router alert.

class pcapkit.protocols.internet.ipv6_opts.schema.CALIPSOOption(type=NO_VALUE, len=NO_VALUE, domain=NO_VALUE, cmpt_len=NO_VALUE, level=NO_VALUE, checksum=NO_VALUE, bitmap=NO_VALUE, pad=NO_VALUE, *, __packet__=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, in 32-bit words.

level: int = <UInt8Field level>

Sens level.

checksum: bytes = <BytesField checksum>

Checksum (CRC-16).

bitmap: bytes = <ConditionalField bitmap>

Compartment bitmap.

pad: bytes = <BytesField pad>

Octets that Opt Data Len covers past the compartment bitmap, kept as read rather than packed as zeros.

class pcapkit.protocols.internet.ipv6_opts.schema._SMFDPDOption(test=NO_VALUE, data=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Schema

Header schema for IPv6-Opts SMF DPD options with generic representation.

The test field forward-matches the first three octets of the option – Option Type, Opt Data Len and the octet carrying the DPD mode bit – without consuming them, so that smf_dpd_data_selector() can size and choose the schema which then reads the option properly. Its namespace offsets are therefore bit offsets into the option, not into any one field of it: Opt Data Len is octet 1, i.e. bits 8 to 15, and the mode bit is the first bit of octet 2 [RFC 6621 Section 6.1.1].

test: SMFDPDTestFlag = <ForwardMatchField test>

SMF DPD mode.

data: SMFIdentificationBasedDPDOption | SMFHashBasedDPDOption = <SwitchField data>

SMF DPD data.

post_process(packet)[source]

Revise schema data after unpacking process.

Parameters:

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

Return type:

SMFDPDOption

Returns:

Revised schema.

class pcapkit.protocols.internet.ipv6_opts.schema.SMFDPDOption(*args, **kwargs)[source]

Bases: Option, EnumSchema[SMFDPDMode]

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

class pcapkit.protocols.internet.ipv6_opts.schema.SMFIdentificationBasedDPDOption(type=NO_VALUE, len=NO_VALUE, info=NO_VALUE, tid=NO_VALUE, id=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: SMFDPDOption

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

Removed in version 1.5.0: test, a field the HOPOPT schema lacks, so that the same octets parse alike under both headers (#441).

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.internet.ipv6_opts.schema.SMFHashBasedDPDOption(type=NO_VALUE, len=NO_VALUE, hav=NO_VALUE, *, __packet__=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:

SMFHashBasedDPDOption

Returns:

Revised schema.

class pcapkit.protocols.internet.ipv6_opts.schema.PDMOption(type=NO_VALUE, len=NO_VALUE, scaledtlr=NO_VALUE, scaledtls=NO_VALUE, psntp=NO_VALUE, psnlr=NO_VALUE, deltatlr=NO_VALUE, deltatls=NO_VALUE, *, __packet__=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 (ScaleDTLR).

scaledtls: int = <UInt8Field scaledtls>

Scale delta time last sent (ScaleDTLS).

psntp: int = <UInt16Field psntp>

Packet sequence number (PSN) this packet (PSNTP).

psnlr: int = <UInt16Field psnlr>

Packet sequence number (PSN) last received (PSNLR).

deltatlr: int = <UInt16Field deltatlr>

Delta time last received (DeltaTLR).

deltatls: int = <UInt16Field deltatls>

Delta time last sent (DeltaTLS).

class pcapkit.protocols.internet.ipv6_opts.schema._QuickStartOption(flags=NO_VALUE, data=NO_VALUE, *, __packet__=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.internet.ipv6_opts.schema.QuickStartOption(*args, **kwargs)[source]

Bases: Option, EnumSchema[QSFunction]

Header schema for IPv6-Opts quick start options.

flags: QuickStartFlags = <BitField flags>

Flags.

class pcapkit.protocols.internet.ipv6_opts.schema.QuickStartRequestOption(type=NO_VALUE, len=NO_VALUE, flags=NO_VALUE, ttl=NO_VALUE, nonce=NO_VALUE, *, __packet__=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.internet.ipv6_opts.schema.QuickStartReportOption(type=NO_VALUE, len=NO_VALUE, flags=NO_VALUE, reserved=NO_VALUE, nonce=NO_VALUE, *, __packet__=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.internet.ipv6_opts.schema.RPLOption(type=NO_VALUE, len=NO_VALUE, flags=NO_VALUE, id=NO_VALUE, rank=NO_VALUE, sub_tlvs=NO_VALUE, *, __packet__=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.

sub_tlvs: bytes = <BytesField sub_tlvs>

Sub-TLVs, kept as raw octets.

class pcapkit.protocols.internet.ipv6_opts.schema.MPLOption(type=NO_VALUE, len=NO_VALUE, flags=NO_VALUE, seq=NO_VALUE, seed=NO_VALUE, pad=NO_VALUE, *, __packet__=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 | IPv6Address = <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.internet.ipv6_opts.schema.ILNPOption(type=NO_VALUE, len=NO_VALUE, nonce=NO_VALUE, *, __packet__=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.internet.ipv6_opts.schema.LineIdentificationOption(type=NO_VALUE, len=NO_VALUE, id_len=NO_VALUE, id=NO_VALUE, *, __packet__=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.internet.ipv6_opts.schema.JumboPayloadOption(type=NO_VALUE, len=NO_VALUE, jumbo_len=NO_VALUE, *, __packet__=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.internet.ipv6_opts.schema.HomeAddressOption(type=NO_VALUE, len=NO_VALUE, addr=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Option

Header schema for IPv6-Opts home address options.

addr: IPv6Address = <IPv6AddressField addr>

Home address.

class pcapkit.protocols.internet.ipv6_opts.schema.IPDFFOption(type=NO_VALUE, len=NO_VALUE, flags=NO_VALUE, seq=NO_VALUE, *, __packet__=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.

Type Stubs

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

Bases: TypedDict

TaggerID information.

mode: int

SMF mode.

type: int

TaggerID type.

len: int

TaggerID length.

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

Bases: TypedDict

Quick-Start flags.

func: int

QS function.

rate: int

Rate request/report.

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

Bases: TypedDict

RPL flags.

down: int

Down flag.

rank_err: int

Rank error flag.

fwd_err: int

Forwarding error flag.

reserved: int

Reserved flag bits.

class pcapkit.protocols.internet.ipv6_opts.schema.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 RFC 7731.

reserved: int

Reserved bits (rsv).

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

Bases: TypedDict

IP_DFF flags.

ver: int

Version.

dup: int

Duplicate flag.

ret: int

Return flag.

reserved: int

Reserved bits.

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

Bases: TypedDict

SMF_DPD test flag.

len: int

Length.

mode: int

DPD mode.

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

Bases: TypedDict

Quick start test flag.

len: int

Option length.

func: int

QS function.

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

Bases: TypedDict

Quick start nonce.

nonce: int

Nonce.

reserved: int

Reserved bits (R).

Auxiliary Functions

The option helpers are shared with schema and documented in pcapkit.protocols.internet.ipv6_ext.schema. The functions below bind them to this module’s error prefix and option schemas; rpl_opt_sub_tlv_len() and pad_opt_data_len() are used unchanged.

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

Return MPL Seed-ID length.

See pcapkit.protocols.internet.ipv6_ext.schema.mpl_opt_seed_id_len(); errors are reported as IPv6-Opts.

Return type:

int

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

Return CALIPSO option padding length.

See pcapkit.protocols.internet.ipv6_ext.schema.calipso_pad_len(); errors are reported as IPv6-Opts.

Return type:

int

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

Return MPL option padding length.

See pcapkit.protocols.internet.ipv6_ext.schema.mpl_opt_pad_len(); errors are reported as IPv6-Opts.

Return type:

int

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

Selector function for _SMFDPDOption.data field.

See pcapkit.protocols.internet.ipv6_ext.schema.smf_dpd_data_selector(), choosing among the schemas registered with SMFDPDOption; errors are reported as IPv6-Opts.

Return type:

FieldBase

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

Selector function for SMFIdentificationBasedDPDOption.tid field.

See pcapkit.protocols.internet.ipv6_ext.schema.smf_i_dpd_tid_selector(); errors are reported as IPv6-Opts.

Return type:

FieldBase

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

Return SMF I-DPD identifier length.

See pcapkit.protocols.internet.ipv6_ext.schema.smf_i_dpd_id_len(); errors are reported as IPv6-Opts.

Return type:

int

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

Selector function for _QuickStartOption.data field.

See pcapkit.protocols.internet.ipv6_ext.schema.quick_start_data_selector(), choosing among the schemas registered with QuickStartOption, and UnassignedOption for an unassigned QS function.

Return type:

FieldBase

Data Models

Removed in version 1.6.0: pcapkit.protocols.data.internet.ipv6_opts, with no alias: the module moved here (#2534).

class pcapkit.protocols.internet.ipv6_opts.data.IPv6_Opts(next, length, options)[source]

Bases: Protocol

Data model for IPv6-Opts protocol.

Changed in version 1.5.0: options is an immutable OrderedMultiInfo rather than an OrderedMultiDict (#1484).

next: TransType

Next header.

length: int

Header length, in octets, decoded from Hdr Ext Len.

options: OrderedMultiInfo[Option, Option]

IPv6-Opts options.

class pcapkit.protocols.internet.ipv6_opts.data.Option(*args, **kwargs)[source]

Bases: Data

Data model for IPv6-Opts option data.

type: Option

Option type.

action: OptionAction

Unknown option action.

change: bool

Change flag.

length: int

Option length (incl. type and length fields).

class pcapkit.protocols.internet.ipv6_opts.data.UnassignedOption(type, action, change, length, data)[source]

Bases: Option

Data model for IPv6-Opts unassigned option.

data: bytes

Option data.

class pcapkit.protocols.internet.ipv6_opts.data.PadOption(type, action, change, length, pad)[source]

Bases: Option

Data model for IPv6-Opts padding options.

Changed in version 1.5.0: New required field pad (#1223).

pad: bytes

Padding octets, i.e. the PadN option data as captured (empty for a Pad1).

class pcapkit.protocols.internet.ipv6_opts.data.TunnelEncapsulationLimitOption(type, action, change, length, limit)[source]

Bases: Option

Data model for IPv6-Opts tunnel encapsulation limit option.

limit: int

Tunnel encapsulation limit.

class pcapkit.protocols.internet.ipv6_opts.data.RouterAlertOption(type, action, change, length, value)[source]

Bases: Option

Data model for IPv6-Opts router alert option.

value: RouterAlert

Router alert value.

class pcapkit.protocols.internet.ipv6_opts.data.CALIPSOOption(type, action, change, length, domain, cmpt_len, level, checksum, pad)[source]

Bases: Option

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

Changed in version 1.5.0: New required field pad (#1403).

domain: int

CALIPSO domain of interpretation.

cmpt_len: int

Compartment bitmap length, in octets – four times the Cmpt Length field, which counts 32-bit words.

level: int

Sensitivity level.

checksum: bytes

Checksum.

pad: bytes

Octets after the compartment bitmap that Opt Data Len covers.

cmpt_bitmap: tuple[int, ...]

Compartment bitmap.

class pcapkit.protocols.internet.ipv6_opts.data.SMFDPDOption(*args, **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.internet.ipv6_opts.data.SMFIdentificationBasedDPDOption(type, action, change, length, dpd_type, tid_type, tid_len, tid, id)[source]

Bases: SMFDPDOption

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

tid_type: TaggerID

TaggerID type.

tid_len: int

TidLen field as on the wire – the TaggerID length in octets minus one, or 0 when there is no TaggerID [RFC 6621 Section 6.1.1].

tid: bytes | IPv4Address | IPv6Address | None

TaggerID.

id: bytes

Identifier.

class pcapkit.protocols.internet.ipv6_opts.data.SMFHashBasedDPDOption(type, action, change, length, dpd_type, hav)[source]

Bases: SMFDPDOption

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

hav: bytes

Hash assist value.

class pcapkit.protocols.internet.ipv6_opts.data.PDMOption(type, action, change, length, scaledtlr, scaledtls, psntp, psnlr, deltatlr, deltatls)[source]

Bases: Option

Data model for IPv6-Opts Performance and 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.internet.ipv6_opts.data.QuickStartOption(*args, **kwargs)[source]

Bases: Option

Data model for IPv6-Opts Quick Start option.

Changed in version 1.5.0: rate is an int rather than a float (#2167).

func: QSFunction

QS function.

rate: int

Rate request/report, in kbps – 40 * 2 ** N for the Rate Request or Rate Report field N, or 0 if N is 0 (RFC 4782 Section 3.1).

class pcapkit.protocols.internet.ipv6_opts.data.QuickStartRequestOption(type, action, change, length, func, rate, ttl, nonce, reserved)[source]

Bases: QuickStartOption

Data model for IPv6-Opts Quick Start request option.

Changed in version 1.5.0: New required field reserved (#1235).

ttl: timedelta

TTL.

nonce: int

Nonce.

reserved: int

Reserved bits (R) after the nonce.

class pcapkit.protocols.internet.ipv6_opts.data.QuickStartReportOption(type, action, change, length, func, rate, nonce, reserved, unused)[source]

Bases: QuickStartOption

Data model for IPv6-Opts Quick Start report of approved rate option.

Changed in version 1.5.0: New required fields reserved (#1235) and unused (#1223).

nonce: int

Nonce.

reserved: int

Reserved bits (R) after the nonce.

unused: bytes

The “Not Used” octet after the rate, as captured.

class pcapkit.protocols.internet.ipv6_opts.data.RPLOption(type, action, change, length, flags, id, rank, sub_tlvs)[source]

Bases: Option

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

Changed in version 1.5.0: New required field sub_tlvs (#1199).

flags: RPLFlags

Flags.

id: int

RPL instance ID.

rank: int

Sender rank.

sub_tlvs: bytes

Sub-TLVs [RFC 6553 Section 3], kept as raw octets.

class pcapkit.protocols.internet.ipv6_opts.data.RPLFlags(down, rank_err, fwd_err, reserved)[source]

Bases: Data

Data model for IPv6-Opts RPL option flags fields.

Changed in version 1.5.0: New required field reserved (#1199).

down: bool

Down flag.

rank_err: bool

Rank error flag.

fwd_err: bool

Forwarding error flag.

reserved: int

Reserved flag bits, carried verbatim so that a rebuild reproduces them.

class pcapkit.protocols.internet.ipv6_opts.data.MPLOption(type, action, change, length, seed_type, flags, seq, seed_id)[source]

Bases: Option

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

Changed in version 1.5.0: seed_id may be an IPv6Address, the source address, for a seed-id type of IPV6_SOURCE_ADDRESS (#1185).

seed_type: SeedID

Seed-ID type, which gives the length of the Seed-ID.

flags: MPLFlags

Flags.

seq: int

Sequence number.

seed_id: int | IPv6Address | None

Seed ID.

class pcapkit.protocols.internet.ipv6_opts.data.MPLFlags(max, drop, reserved)[source]

Bases: Data

Data model for IPv6-Opts MPL option flags fields.

Changed in version 1.5.0: New required field reserved (#1235).

max: bool

Max flag.

drop: bool

Non-conformance flag.

reserved: int

Reserved bits (rsv).

class pcapkit.protocols.internet.ipv6_opts.data.ILNPOption(type, action, change, length, nonce)[source]

Bases: Option

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

nonce: int

Nonce value.

class pcapkit.protocols.internet.ipv6_opts.data.LineIdentificationOption(type, action, change, length, line_id_len, line_id)[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.internet.ipv6_opts.data.JumboPayloadOption(type, action, change, length, jumbo_len)[source]

Bases: Option

Data model for Jumbo Payload option.

jumbo_len: int

Jumbo payload length.

class pcapkit.protocols.internet.ipv6_opts.data.HomeAddressOption(type, action, change, length, address)[source]

Bases: Option

Data model for IPv6-Opts Home Address option.

address: IPv6Address

Home address.

class pcapkit.protocols.internet.ipv6_opts.data.IPDFFOption(type, action, change, length, version, flags, seq)[source]

Bases: Option

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

version: int

Version.

flags: DFFFlags

Flags.

seq: int

Sequence number.

class pcapkit.protocols.internet.ipv6_opts.data.DFFFlags(dup, ret, reserved)[source]

Bases: Data

Data model for IPv6-Opts IP_DFF option flags.

Changed in version 1.5.0: New required field reserved (#1235).

dup: bool

Duplicate flag.

ret: bool

Return flag.

reserved: int

Reserved bits, i.e. the low four bits of the flags octet.

Footnotes