No-Payload Packet

pcapkit.protocols.misc.no_payload contains NoPayload only, which implements a Protocol like object whose payload is recursively NoPayload itself.

Added in version 1.6.0: Moved here from pcapkit.protocols.misc.null, with its data model and header schema, since a protocol class is named after its module (#2529).

Removed in version 1.6.0: pcapkit.protocols.misc.null, pcapkit.protocols.data.misc.null and pcapkit.protocols.schema.misc.null, with no alias (#2529).

class pcapkit.protocols.misc.no_payload.NoPayload(file=None, length=None, **kwargs)[source]

Bases: ProtocolBase[NoPayload, NoPayload]

This class implements no-payload protocol.

Its payload is the instance itself, so a .payload walk over it never terminates; bound any such loop, or walk the protocol chain of the enclosing packet instead.

property name: Literal['Null']

Name of current protocol.

property length: Literal[0]

Header length of current protocol.

property protocol: NoReturn

Name of next layer protocol.

Raises:

UnsupportedCall – This protocol doesn’t support protocol.

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

Read (parse) packet data.

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

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

Return type:

NoPayload

Returns:

Parsed packet data.

make(**kwargs)[source]

Make (construct) packet data.

Parameters:

**kwargs (Any) – Arbitrary keyword arguments.

Return type:

NoPayload

Returns:

Constructed packet schema.

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

Post initialisation hook.

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

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

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

classmethod __index__()[source]

Numeral registry index of the protocol.

Raises:

UnsupportedCall – This protocol has no registry entry.

Return type:

NoReturn

Header Schemas

class pcapkit.protocols.schema.misc.no_payload.NoPayload[source]

Bases: Schema

Schema for empty payload.

Data Models

class pcapkit.protocols.data.misc.no_payload.NoPayload[source]

Bases: Protocol

No-payload packet is an empty packet.