SNAP - Subnetwork Access Protocol

pcapkit.protocols.link.snap.protocol contains SNAP, which implements the extractor for the IEEE 802 Subnetwork Access Protocol (SNAP) [*] header, the information field of an LLC PDU addressed to the SNAP LSAP, whose structure is:

Octets

Bits

Name

Description

0

0

snap.oui

Organizationally Unique Identifier

3

24

snap.pid

Protocol identifier

Under the OUI 00-00-00 the protocol identifier is an EtherType (RFC 9542 Section 3), and the payload is dispatched as Ethernet dispatches it; under any other it is kept as Raw.

Added in version 1.9.0.

class pcapkit.protocols.link.snap.protocol.SNAP(file, length=None, /, *, layer=None, protocol=None, context=None)[source]

Bases: Link[SNAP, SNAP]

This class implements IEEE 802 Subnetwork Access Protocol.

The header is the information field of an LLC PDU whose DSAP is SNAP. Under the OUI 00-00-00 the protocol identifier is an EtherType (RFC 9542 Section 3), and the payload is dispatched through Link.__proto__ as Ethernet dispatches it. Under any other OUI the protocol identifier is that organization’s, and the payload is kept as Raw.

Added in version 1.9.0.

Properties

property name: Literal['Subnetwork Access Protocol']

Name of current protocol.

property length: Literal[5]

Header length of current protocol.

Methods

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

Read IEEE 802 Subnetwork Access Protocol.

Structure of SNAP header [IEEE Std 802]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      Organizationally Unique Identifier       |  Protocol...  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|...Identifier  |
+-+-+-+-+-+-+-+-+
Parameters:
  • length (int | None) – Length of packet data.

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

Return type:

SNAP

Returns:

Parsed packet data.

make(*, oui=0x000000, pid=EtherType.Internet_Protocol_version_4, payload=b'', **kwargs)[source]

Make (construct) packet data.

Parameters:
  • oui (int) – Organizationally Unique Identifier.

  • pid (EtherType | int) – Protocol identifier, an EtherType where oui is 00-00-00.

  • payload (bytes | ProtocolBase | Schema) – Payload data.

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

Return type:

SNAP

Returns:

Constructed packet data.

Raises:

ProtocolError – If oui does not fit in 24 bits, or pid is a name, a bool, or a code its field cannot carry.

Data Models

__length_hint__()[source]

Return an estimated length for the object.

Return type:

Literal[5]

classmethod __index__()[source]

Numeral registry index of the protocol.

Return type:

LSAP

Returns:

Numeral registry index of the protocol in the LLC address values, since no link type, EtherType, protocol number or port names it.

Utilities

classmethod _make_data(data)[source]

Create key-value pairs from data for protocol construction.

Parameters:

data (SNAP) – protocol data

Return type:

dict[str, Any]

Returns:

Key-value pairs for protocol construction.

Header Schemas

class pcapkit.protocols.link.snap.schema.SNAP(oui=NO_VALUE, pid=NO_VALUE, payload=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Schema

Header schema for SNAP headers.

oui: bytes = <BytesField oui>

Organizationally Unique Identifier.

pid: int = <UInt16Field pid>

Protocol identifier.

payload: bytes = <PayloadField payload>

Payload.

Data Models

class pcapkit.protocols.link.snap.data.SNAP(oui, pid)[source]

Bases: Protocol

Data model for SNAP headers.

oui: int

Organizationally Unique Identifier.

pid: EtherType | int

Protocol identifier, an EtherType where oui is 00-00-00.

Footnotes