SCTP - Stream Control Transmission Protocol

pcapkit.protocols.transport.sctp contains SCTP only, which implements the extractor for Stream Control Transmission Protocol (SCTP) [*], whose structure is described as below:

Octets

Bits

Name

Description

0

0

sctp.srcport

Source Port

2

16

sctp.dstport

Destination Port

4

32

sctp.vtag

Verification Tag

8

64

sctp.chksum

Checksum (CRC32c)

12

96

sctp.chunks

Chunks

class pcapkit.protocols.transport.sctp.SCTP(file=None, length=None, **kwargs)[source]

Bases: Transport[SCTP, SCTP]

This class implements Stream Control Transmission Protocol.

Unlike TCP and UDP, SCTP does not dispatch the next layer on port numbers: user data travels inside DATA chunks, and each DATA chunk names its upper layer through its payload protocol identifier (PPID). The self.__proto__ registry is therefore keyed by PPID rather than by port number, and is populated through SCTP.register():

>>> from pcapkit.const.sctp.payload_protocol_identifier import PayloadProtocolIdentifier
>>> SCTP.register(PayloadProtocolIdentifier.PayloadProtocolIdentifier_3GPP_NG_Application_Protocol, NGAP)
>>> SCTP.register(60, NGAP)  # equivalent, PPID given as a plain integer

By default, PPIDs 60 (PayloadProtocolIdentifier_3GPP_NG_Application_Protocol) and 66 (PayloadProtocolIdentifier_3GPP_NGAP_over_DTLS_over_SCTP) are registered to NGAP, and every other PPID resolves to Raw.

Only PPID 60 actually decodes. A PPID 66 payload is an NGAP PDU wrapped in a DTLS record, and pcapkit has no DTLS implementation, so the bytes are not aligned PER and the parse always degrades to Raw. It is registered so that the PPID is named in the protochain rather than reported as an unassigned number.

This class supports parsing of the following SCTP chunks, which are directly mapped to the pcapkit.const.sctp.chunk.Chunk enumeration:

Any other chunk type – unassigned, reserved, or defined by an SCTP extension that pcapkit does not implement – falls through to _read_chunk_donone(), which records the chunk’s raw flags and value verbatim rather than raising.

This class supports parsing of the following chunk parameters, which are directly mapped to the pcapkit.const.sctp.parameter.Parameter enumeration:

This class supports parsing of every error cause defined by RFC 9260 Section 3.3.10, which are directly mapped to the pcapkit.const.sctp.cause_code.CauseCode enumeration; see self.__cause__ for the mapping. Unknown cause codes fall through to _read_cause_donone().

Added in version 1.5.0.

property name: Literal['Stream Control Transmission Protocol']

Name of current protocol.

property length: Literal[12]

Header length of current protocol, i.e. the SCTP common header.

property src: AppType

Source port.

property dst: AppType

Destination port.

property ppid: PayloadProtocolIdentifier | None

Payload protocol identifier of the first DATA chunk of the packet.

Returns:

The PPID used to dispatch the next layer, or None if the packet carries no DATA chunk.

property checksum_valid: bool

Whether the recorded CRC32c checksum matches the packet.

The SCTP checksum covers the common header and every chunk with the checksum field itself zeroed, and – unlike the TCP and UDP checksums – involves no IP pseudo-header, so it can be verified from the SCTP packet alone. See RFC 9260 Section 6.8.

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

Read Stream Control Transmission Protocol (SCTP).

Structure of SCTP common header [RFC 9260]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      Source Port Number       |    Destination Port Number    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                       Verification Tag                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           Checksum                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           Chunk #1                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              ...                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           Chunk #n                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
  • length (int | None) – Length of packet data.

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

Return type:

SCTP

Returns:

Parsed packet data.

make(srcport=0, dstport=0, vtag=0, chksum=None, chunks=None, trailer=b'', **kwargs)[source]

Make (construct) packet data.

Parameters:
Return type:

SCTP

Returns:

Constructed packet data.

Raises:

ProtocolError – If srcport or dstport is a bool (#2287).

Note

There is no payload argument: SCTP carries its user data in the data field of a DATA chunk, so the payload is supplied as part of that chunk.

classmethod register(code, protocol)[source]

Register a new protocol class for a payload protocol identifier.

Notes

The fully qualified class name of the new protocol class should be {protocol.module}.{protocol.name}.

Parameters:

Important

SCTP overrides Transport.register because its self.__proto__ registry is keyed by PPID rather than by port number.

Raises:

pcapkit.utilities.exceptions.RegistryError – If protocol is not a class, or not a ProtocolBase subclass.

Warns:

pcapkit.utilities.warnings.RegistryWarning – If this PPID is already registered and the incumbent differs from the replacement; the message names both. As with the port-keyed Transport.register it overrides, an unresolved ModuleDescriptor incumbent counts as different from the class it names; handing back the stored entry, or a descriptor equal to it, is a silent no-op that keeps it, and handing back the descriptor a PPID shipped with restores that object, unresolved (#1504).

classmethod register_chunk(code, meth)[source]

Register a chunk 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. Re-registering the entry code shipped with is accepted like any other, so an override can be undone (#1362, #1363).

classmethod register_parameter(code, meth)[source]

Register a chunk parameter 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. Re-registering the entry code shipped with is accepted like any other, so an override can be undone (#1362, #1363).

classmethod register_cause(code, meth)[source]

Register an error cause 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. Re-registering the entry code shipped with is accepted like any other, so an override can be undone (#1362, #1363).

static crc32c(data)[source]

Calculate the CRC32c of data.

SCTP uses the CRC32c (Castagnoli) polynomial rather than the one’s complement internet checksum used by TCP, UDP and IP. The algorithm is the reflected, table-driven one given by RFC 9260 Appendix A, with the remainder register initialised to all ones and the result complemented.

Parameters:

data (bytes) – Data to checksum.

Return type:

int

Returns:

The CRC32c value, in host order.

classmethod calculate_checksum(packet)[source]

Calculate the checksum field of an SCTP packet.

Per RFC 9260 Section 6.8, the checksum field is first zeroed, the CRC32c of the whole packet is then computed, and the result is written back into the checksum field. Per RFC 9260 Appendix A the resulting four bytes are the CRC32c value in little-endian order.

Parameters:

packet (bytes) – Whole SCTP packet, i.e. the common header followed by every chunk. The current contents of the checksum field are ignored.

Return type:

bytes

Returns:

The four bytes to place in the checksum field.

Raises:

ProtocolError – If packet is shorter than the 12-byte SCTP common header.

classmethod validate_checksum(packet)[source]

Validate the checksum field of an SCTP packet.

Parameters:

packet (bytes) – Whole SCTP packet, i.e. the common header followed by every chunk.

Return type:

bool

Returns:

Whether the checksum field matches the packet contents.

Raises:

ProtocolError – If packet is shorter than the 12-byte SCTP common header.

classmethod _make_data(data)[source]

Create key-value pairs from data for protocol construction.

Parameters:

data (SCTP) – protocol data

Return type:

dict[str, Any]

Returns:

Key-value pairs for protocol construction.

_get_payload()[source]

Get payload of the packet.

SCTP has no payload field in its header schema – user data travels inside DATA chunks – so this returns the user data of the first DATA chunk found by self.read, which is also the chunk whose payload protocol identifier selects the next layer. Should the packet carry no DATA chunk, an empty bytes is returned and the next layer resolves to NoPayload.

Return type:

bytes

Returns:

Payload of the packet as bytes.

_decode_next_layer(dict_, proto=None, length=None, *, packet=None)[source]

Decode next layer protocol.

Parameters:
  • dict_ (SCTP) – info buffer

  • proto (int | None) – payload protocol identifier of the DATA chunk carrying the payload, if any

  • length (int | None) – valid (non-padding) length

  • packet (dict[str, Any] | None) – packet info (passed from self.unpack)

Return type:

SCTP

Returns:

Current protocol with next layer extracted.

Important

This deliberately bypasses Transport._decode_next_layer, which keys the lookup on port numbers, since SCTP keys it on the DATA chunk’s payload protocol identifier instead.

The PPID is passed through unchanged, registered or not, so that an unregistered payload is still labelled with the identifier it arrived with, as Internet._import_next_layer does for an unregistered transport type. Resolving it to Raw is Protocol._import_next_layer’s job, through Protocol._lookup_next_layer, which leaves self.__proto__ untouched.

_read_sctp_chunks()[source]

Read SCTP chunk list.

Return type:

OrderedMultiDict[Chunk, Chunk]

Returns:

Extracted SCTP chunks.

Raises:

ProtocolError – If a raw chunk given to make() is not a whole chunk. Parsed, its octets would fall to the trailer rather than to the chunk list, so it is rejected (#1468).

_make_sctp_chunks(chunks)[source]

Make chunks for SCTP.

Parameters:

chunks (list[Chunk | tuple[Chunk, dict[str, Any]] | bytes] | OrderedMultiDict[Chunk, Chunk]) – SCTP chunks.

Return type:

list[Chunk | bytes]

Returns:

Constructed chunk schemas.

Note

No alignment fix-up happens here, unlike TCP._make_tcp_options: every chunk pads itself to the four-byte boundary required by RFC 9260 Section 3.2. A chunk without a nested list carries its own trailing PaddingField, computed from the chunk’s own length; one with a nested parameter or error cause list folds its padding into that list, see nested_length().

_make_sctp_chunk(code, chunk=None, **kwargs)[source]

Dispatch to the chunk constructor registered for code.

Parameters:
  • code (Chunk) – SCTP chunk type.

  • chunk (Chunk | None) – Chunk data, if constructing from a parsed data model.

  • **kwargs (Any) – Arbitrary keyword arguments for the constructor.

Return type:

Chunk

Returns:

Constructed chunk schema.

_read_sctp_parameters(schemas)[source]

Read SCTP chunk parameter list.

Parameters:

schemas (list[Parameter]) – Parsed parameter schemas.

Return type:

OrderedMultiDict[Parameter, Parameter]

Returns:

Extracted SCTP chunk parameters.

_make_sctp_parameters(parameters)[source]

Make chunk parameters for SCTP.

Parameters:

parameters (list[Parameter | tuple[Parameter, dict[str, Any]] | bytes] | OrderedMultiDict[Parameter, Parameter]) – SCTP chunk parameters.

Return type:

list[Parameter | bytes]

Returns:

Constructed parameter schemas.

_make_sctp_parameter(code, parameter=None, **kwargs)[source]

Dispatch to the parameter constructor registered for code.

Parameters:
  • code (Parameter) – SCTP chunk parameter type.

  • parameter (Parameter | None) – Parameter data, if constructing from a parsed data model.

  • **kwargs (Any) – Arbitrary keyword arguments for the constructor.

Return type:

Parameter

Returns:

Constructed parameter schema.

_read_sctp_causes(schemas)[source]

Read SCTP error cause list.

Parameters:

schemas (list[ErrorCause]) – Parsed error cause schemas.

Return type:

OrderedMultiDict[CauseCode, ErrorCause]

Returns:

Extracted SCTP error causes.

_make_sctp_causes(causes)[source]

Make error causes for SCTP.

Parameters:

causes (list[ErrorCause | tuple[CauseCode, dict[str, Any]] | bytes] | OrderedMultiDict[CauseCode, ErrorCause]) – SCTP error causes.

Return type:

list[ErrorCause | bytes]

Returns:

Constructed error cause schemas.

_make_sctp_cause(code, cause=None, **kwargs)[source]

Dispatch to the error cause constructor registered for code.

Parameters:
  • code (CauseCode) – SCTP error cause code.

  • cause (ErrorCause | None) – Cause data, if constructing from a parsed data model.

  • **kwargs (Any) – Arbitrary keyword arguments for the constructor.

Return type:

ErrorCause

Returns:

Constructed error cause schema.

_make_param_types(types)[source]

Resolve a list of parameter types.

Shared by _make_param_addrtypes() and _make_cause_missing_param(), whose types both list parameter types.

Parameters:

types (list[Parameter | int] | None) – parameter types, each given as a Parameter or an int

Return type:

list[Parameter]

Returns:

The Parameter for each item.

Raises:

ProtocolError – If an item is a bool, or is neither a Parameter nor an int (#2288).

_read_chunk_donone(schema, *, chunks)[source]

Read SCTP chunk of an unsupported type.

This is the fall-through for every chunk type pcapkit does not implement – unassigned, reserved, or defined by an SCTP extension – as well as for the SCTP-defined but reserved ECNE and CWR chunks. The chunk’s raw flags and value are recorded verbatim rather than raising, so that a bundle containing an unknown chunk still parses.

Parameters:
Return type:

UnknownChunk

Returns:

Parsed chunk data.

_read_chunk_data(schema, *, chunks)[source]

Read SCTP DATA chunk.

Structure of SCTP DATA chunk [RFC 9260 Section 3.3.1]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Type = 0    |  Res  |I|U|B|E|            Length             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              TSN                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      Stream Identifier S      |   Stream Sequence Number n     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                  Payload Protocol Identifier                  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
\                                                               \
/                 User Data (seq n of Stream S)                 /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

DATAChunk

Returns:

Parsed chunk data.

Raises:

ProtocolError – If length is NOT greater than 16, since RFC 9260 Section 3.3.1 requires at least one byte of user data.

_read_chunk_init(schema, *, chunks)[source]

Read SCTP INIT chunk.

Structure of SCTP INIT chunk [RFC 9260 Section 3.3.2]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Type = 1    |  Chunk Flags  |      Chunk Length             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                         Initiate Tag                          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Advertised Receiver Window Credit (a_rwnd)           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Number of Outbound Streams   |   Number of Inbound Streams   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                          Initial TSN                          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
\                                                               \
/              Optional/Variable-Length Parameters              /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

INITChunk

Returns:

Parsed chunk data.

Raises:

ProtocolError – If length is NOT at least 20.

_read_chunk_init_ack(schema, *, chunks)[source]

Read SCTP INIT ACK chunk.

Structure of SCTP INIT ACK chunk [RFC 9260 Section 3.3.3]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Type = 2    |  Chunk Flags  |         Chunk Length          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                         Initiate Tag                          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|               Advertised Receiver Window Credit               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Number of Outbound Streams   |   Number of Inbound Streams   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                          Initial TSN                          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
\                                                               \
/              Optional/Variable-Length Parameters              /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

INITACKChunk

Returns:

Parsed chunk data.

Raises:

ProtocolError – If length is NOT at least 20.

_read_chunk_sack(schema, *, chunks)[source]

Read SCTP SACK chunk.

Structure of SCTP SACK chunk [RFC 9260 Section 3.3.4]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Type = 3    |  Chunk Flags  |         Chunk Length          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                      Cumulative TSN Ack                       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Advertised Receiver Window Credit (a_rwnd)           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Number of Gap Ack Blocks = N  |  Number of Duplicate TSNs = M |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|    Gap Ack Block #1 Start     |     Gap Ack Block #1 End      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/                              ...                              /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        Duplicate TSN 1                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/                              ...                              /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

SACKChunk

Returns:

Parsed chunk data.

Raises:

ProtocolError – If length does NOT match the declared number of gap ack blocks and duplicate TSNs.

_read_chunk_heartbeat(schema, *, chunks)[source]

Read SCTP HEARTBEAT chunk.

Structure of SCTP HEARTBEAT chunk [RFC 9260 Section 3.3.5]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Type = 4    |  Chunk Flags  |       Heartbeat Length        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
\                                                               \
/          Heartbeat Information TLV (Variable-Length)          /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

HeartbeatChunk

Returns:

Parsed chunk data.

Raises:

ProtocolError – If length is NOT at least 4.

Note

RFC 9260 Section 3.3.5 mandates exactly one Heartbeat Info parameter, but the parameters are modelled as a list so that a sender emitting more (or none) still parses.

_read_chunk_heartbeat_ack(schema, *, chunks)[source]

Read SCTP HEARTBEAT ACK chunk.

Structure of SCTP HEARTBEAT ACK chunk [RFC 9260 Section 3.3.6]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Type = 5    |  Chunk Flags  |     Heartbeat Ack Length      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
\                                                               \
/          Heartbeat Information TLV (Variable-Length)          /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

HeartbeatACKChunk

Returns:

Parsed chunk data.

Raises:

ProtocolError – If length is NOT at least 4.

_read_chunk_abort(schema, *, chunks)[source]

Read SCTP ABORT chunk.

Structure of SCTP ABORT chunk [RFC 9260 Section 3.3.7]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Type = 6    |  Reserved   |T|            Length             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
\                                                               \
/                   zero or more Error Causes                   /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

AbortChunk

Returns:

Parsed chunk data.

Raises:

ProtocolError – If length is NOT at least 4.

_read_chunk_shutdown(schema, *, chunks)[source]

Read SCTP SHUTDOWN chunk.

Structure of SCTP SHUTDOWN chunk [RFC 9260 Section 3.3.8]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Type = 7    |  Chunk Flags  |          Length = 8           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                      Cumulative TSN Ack                       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

ShutdownChunk

Returns:

Parsed chunk data.

Raises:

ProtocolError – If length is NOT 8.

_read_chunk_shutdown_ack(schema, *, chunks)[source]

Read SCTP SHUTDOWN ACK chunk.

Structure of SCTP SHUTDOWN ACK chunk [RFC 9260 Section 3.3.9]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Type = 8    |  Chunk Flags  |          Length = 4           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

ShutdownACKChunk

Returns:

Parsed chunk data.

Raises:

ProtocolError – If length is NOT 4.

_read_chunk_error(schema, *, chunks)[source]

Read SCTP ERROR chunk.

Structure of SCTP ERROR chunk [RFC 9260 Section 3.3.10]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Type = 9    |  Chunk Flags  |            Length             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
\                                                               \
/                   one or more Error Causes                    /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

ErrorChunk

Returns:

Parsed chunk data.

Raises:

ProtocolError – If length is NOT at least 4.

Read SCTP COOKIE ECHO chunk.

Structure of SCTP COOKIE ECHO chunk [RFC 9260 Section 3.3.11]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Type = 10   |  Chunk Flags  |            Length             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/                            Cookie                             /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

CookieEchoChunk

Returns:

Parsed chunk data.

Raises:

ProtocolError – If length is NOT at least 4.

Note

A COOKIE ECHO chunk carries the contents of the state cookie parameter rather than the parameter itself, so the cookie is a plain bytes here rather than a StateCookieParameter.

Read SCTP COOKIE ACK chunk.

Structure of SCTP COOKIE ACK chunk [RFC 9260 Section 3.3.12]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Type = 11   |  Chunk Flags  |          Length = 4           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

CookieACKChunk

Returns:

Parsed chunk data.

Raises:

ProtocolError – If length is NOT 4.

_read_chunk_shutdown_complete(schema, *, chunks)[source]

Read SCTP SHUTDOWN COMPLETE chunk.

Structure of SCTP SHUTDOWN COMPLETE chunk [RFC 9260 Section 3.3.13]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Type = 14   |  Reserved   |T|          Length = 4           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

ShutdownCompleteChunk

Returns:

Parsed chunk data.

Raises:

ProtocolError – If length is NOT 4.

_make_chunk_donone(code, chunk=None, *, flags=b'\x00', value=b'', **kwargs)[source]

Make SCTP chunk of an unsupported type.

Parameters:
  • code (Chunk) – chunk type

  • chunk (UnknownChunk | None) – chunk data

  • flags (bytes) – raw chunk flags, as a single byte

  • value (bytes) – chunk value in bytes

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

UnknownChunk

Returns:

Constructed chunk schema.

Raises:

ProtocolError – If flags is NOT exactly one byte.

_make_chunk_data(code, chunk=None, *, reserved=0, I=False, U=False, B=True, E=True, tsn=0, stream_id=0, stream_seq=0, ppid=0, data=b'', **kwargs)[source]

Make SCTP DATA chunk.

Parameters:
  • code (Chunk) – chunk type

  • chunk (DATAChunk | None) – chunk data

  • reserved (int) – reserved flag bits

  • I (bool) – immediate bit

  • U (bool) – unordered bit

  • B (bool) – beginning fragment bit

  • E (bool) – ending fragment bit

  • tsn (int) – transmission sequence number

  • stream_id (int) – stream identifier

  • stream_seq (int) – stream sequence number

  • ppid (PayloadProtocolIdentifier | int) – payload protocol identifier

  • data (bytes) – user data

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

DATAChunk

Returns:

Constructed chunk schema.

Raises:

ProtocolError – If data is empty, since RFC 9260 Section 3.3.1 requires at least one byte of user data.

_make_chunk_init(code, chunk=None, *, flags=b'\x00', init_tag=0, a_rwnd=1500, outbound_streams=1, inbound_streams=1, init_tsn=0, parameters=None, **kwargs)[source]

Make SCTP INIT chunk.

Parameters:
Return type:

INITChunk

Returns:

Constructed chunk schema.

Raises:

ProtocolError – If flags is NOT exactly one byte.

Note

The chunk flags are reserved by RFC 9260 Section 3.3.2, so they default to zero; a parsed chunk’s flags are kept as received.

_make_chunk_init_ack(code, chunk=None, *, flags=b'\x00', init_tag=0, a_rwnd=1500, outbound_streams=1, inbound_streams=1, init_tsn=0, parameters=None, **kwargs)[source]

Make SCTP INIT ACK chunk.

Parameters:
Return type:

INITACKChunk

Returns:

Constructed chunk schema.

Raises:

ProtocolError – If flags is NOT exactly one byte.

_make_chunk_sack(code, chunk=None, *, flags=b'\x00', cum_tsn_ack=0, a_rwnd=1500, gap_blocks=None, dup_tsn=None, **kwargs)[source]

Make SCTP SACK chunk.

Parameters:
  • code (Chunk) – chunk type

  • chunk (SACKChunk | None) – chunk data

  • flags (bytes) – raw chunk flags, as a single byte

  • cum_tsn_ack (int) – cumulative TSN ack

  • a_rwnd (int) – advertised receiver window credit

  • gap_blocks (list[GapAckBlock | GapAckBlock | tuple[int, int]] | None) – gap ack blocks, each as a schema, a data model or a (start, end) pair

  • dup_tsn (list[int] | None) – duplicate TSNs

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

SACKChunk

Returns:

Constructed chunk schema.

Raises:

ProtocolError – If flags is NOT exactly one byte.

Note

The counts of gap ack blocks and duplicate TSNs are derived from the supplied lists rather than taken as arguments, so that they cannot disagree with the lists they count.

_make_chunk_heartbeat(code, chunk=None, *, flags=b'\x00', parameters=None, **kwargs)[source]

Make SCTP HEARTBEAT chunk.

Parameters:
Return type:

HeartbeatChunk

Returns:

Constructed chunk schema.

Raises:

ProtocolError – If flags is NOT exactly one byte.

_make_chunk_heartbeat_ack(code, chunk=None, *, flags=b'\x00', parameters=None, **kwargs)[source]

Make SCTP HEARTBEAT ACK chunk.

Parameters:
Return type:

HeartbeatACKChunk

Returns:

Constructed chunk schema.

Raises:

ProtocolError – If flags is NOT exactly one byte.

_make_chunk_abort(code, chunk=None, *, reserved=0, T=False, error=None, **kwargs)[source]

Make SCTP ABORT chunk.

Parameters:
Return type:

AbortChunk

Returns:

Constructed chunk schema.

_make_chunk_shutdown(code, chunk=None, *, flags=b'\x00', cum_tsn_ack=0, **kwargs)[source]

Make SCTP SHUTDOWN chunk.

Parameters:
  • code (Chunk) – chunk type

  • chunk (ShutdownChunk | None) – chunk data

  • flags (bytes) – raw chunk flags, as a single byte

  • cum_tsn_ack (int) – cumulative TSN ack

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

ShutdownChunk

Returns:

Constructed chunk schema.

Raises:

ProtocolError – If flags is NOT exactly one byte.

_make_chunk_shutdown_ack(code, chunk=None, *, flags=b'\x00', **kwargs)[source]

Make SCTP SHUTDOWN ACK chunk.

Parameters:
  • code (Chunk) – chunk type

  • chunk (ShutdownACKChunk | None) – chunk data

  • flags (bytes) – raw chunk flags, as a single byte

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

ShutdownACKChunk

Returns:

Constructed chunk schema.

Raises:

ProtocolError – If flags is NOT exactly one byte.

_make_chunk_error(code, chunk=None, *, flags=b'\x00', error=None, **kwargs)[source]

Make SCTP ERROR chunk.

Parameters:
Return type:

ErrorChunk

Returns:

Constructed chunk schema.

Raises:

ProtocolError – If flags is NOT exactly one byte.

Make SCTP COOKIE ECHO chunk.

Parameters:
  • code (Chunk) – chunk type

  • chunk (CookieEchoChunk | None) – chunk data

  • flags (bytes) – raw chunk flags, as a single byte

  • cookie (bytes) – state cookie, as received in the INIT ACK chunk’s state cookie parameter

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

CookieEchoChunk

Returns:

Constructed chunk schema.

Raises:

ProtocolError – If flags is NOT exactly one byte.

Make SCTP COOKIE ACK chunk.

Parameters:
  • code (Chunk) – chunk type

  • chunk (CookieACKChunk | None) – chunk data

  • flags (bytes) – raw chunk flags, as a single byte

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

CookieACKChunk

Returns:

Constructed chunk schema.

Raises:

ProtocolError – If flags is NOT exactly one byte.

_make_chunk_shutdown_complete(code, chunk=None, *, reserved=0, T=False, **kwargs)[source]

Make SCTP SHUTDOWN COMPLETE chunk.

Parameters:
  • code (Chunk) – chunk type

  • chunk (ShutdownCompleteChunk | None) – chunk data

  • reserved (int) – reserved flag bits

  • T (bool) – whether the verification tag has been reflected

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

ShutdownCompleteChunk

Returns:

Constructed chunk schema.

_read_param_donone(schema, *, parameters)[source]

Read SCTP chunk parameter of an unsupported type.

This is the fall-through for every chunk parameter type pcapkit does not implement. The parameter’s value is recorded verbatim rather than raising, so a chunk carrying an unknown parameter still parses.

Parameters:
Return type:

UnknownParameter

Returns:

Parsed parameter data.

_read_param_hbinfo(schema, *, parameters)[source]

Read SCTP heartbeat info parameter.

Structure of SCTP heartbeat info parameter [RFC 9260 Section 3.3.5]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|    Heartbeat Info Type = 1    |        HB Info Length         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/                Sender-Specific Heartbeat Info                 /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

HeartbeatInfoParameter

Returns:

Parsed parameter data.

Raises:

ProtocolError – If length is NOT at least 4.

_read_param_ipv4(schema, *, parameters)[source]

Read SCTP IPv4 address parameter.

Structure of SCTP IPv4 address parameter [RFC 9260 Section 3.3.2.1.1]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Type = 5            |          Length = 8           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                         IPv4 Address                          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

IPv4AddressParameter

Returns:

Parsed parameter data.

Raises:

ProtocolError – If length is NOT 8.

_read_param_ipv6(schema, *, parameters)[source]

Read SCTP IPv6 address parameter.

Structure of SCTP IPv6 address parameter [RFC 9260 Section 3.3.2.1.2]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Type = 6            |          Length = 20          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
|                         IPv6 Address                          |
|                                                               |
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

IPv6AddressParameter

Returns:

Parsed parameter data.

Raises:

ProtocolError – If length is NOT 20.

Read SCTP state cookie parameter.

Structure of SCTP state cookie parameter [RFC 9260 Section 3.3.3.1.1]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Type = 7            |            Length             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/                            Cookie                             /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

StateCookieParameter

Returns:

Parsed parameter data.

Raises:

ProtocolError – If length is NOT at least 4.

_read_param_unrecognized(schema, *, parameters)[source]

Read SCTP unrecognized parameter parameter.

Structure of SCTP unrecognized parameter [RFC 9260 Section 3.3.3.1.2]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Type = 8            |            Length             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/                  Unrecognized Parameter                       /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

UnrecognizedParameter

Returns:

Parsed parameter data.

Raises:

ProtocolError – If length is NOT at least 4.

Note

The offending parameter is recorded as raw bytes, complete with its own type and length, rather than being parsed recursively: by definition the sender did not recognise it, so neither interpretation nor validation of its contents would be meaningful.

_read_param_preservative(schema, *, parameters)[source]

Read SCTP cookie preservative parameter.

Structure of SCTP cookie preservative parameter [RFC 9260 Section 3.3.2.1.3]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Type = 9            |          Length = 8           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         Suggested Cookie Life-Span Increment (msec.)          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

CookiePreservativeParameter

Returns:

Parsed parameter data.

Raises:

ProtocolError – If length is NOT 8.

_read_param_hostname(schema, *, parameters)[source]

Read SCTP host name address parameter.

Structure of SCTP host name address parameter [RFC 9260 Section 3.3.2.1.4]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Type = 11           |            Length             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/                           Host Name                           /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

HostNameAddressParameter

Returns:

Parsed parameter data.

Raises:

ProtocolError – If length is NOT at least 4.

Note

The usage of this parameter is deprecated by RFC 9260 Section 3.3.2.1.4; it is parsed so that a packet carrying one can still be inspected. The host name is kept as raw bytes, including any null terminator, since the encoding is not specified on the wire. A name captured without a terminator is kept as read and rebuilds as read (#1482).

_read_param_addrtypes(schema, *, parameters)[source]

Read SCTP supported address types parameter.

Structure of SCTP supported address types parameter [RFC 9260 Section 3.3.2.1.5]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Type = 12           |            Length             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Address Type #1        |        Address Type #2        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            ......                             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

SupportedAddressTypesParameter

Returns:

Parsed parameter data.

Raises:

ProtocolError – If length is NOT 4 plus a multiple of 2.

_make_param_donone(code, param=None, *, value=b'', **kwargs)[source]

Make SCTP chunk parameter of an unsupported type.

Parameters:
Return type:

UnknownParameter

Returns:

Constructed parameter schema.

_make_param_hbinfo(code, param=None, *, info=b'', **kwargs)[source]

Make SCTP heartbeat info parameter.

Parameters:
Return type:

HeartbeatInfoParameter

Returns:

Constructed parameter schema.

_make_param_ipv4(code, param=None, *, address='0.0.0.0', **kwargs)[source]

Make SCTP IPv4 address parameter.

Parameters:
Return type:

IPv4AddressParameter

Returns:

Constructed parameter schema.

_make_param_ipv6(code, param=None, *, address='::', **kwargs)[source]

Make SCTP IPv6 address parameter.

Parameters:
Return type:

IPv6AddressParameter

Returns:

Constructed parameter schema.

Make SCTP state cookie parameter.

Parameters:
Return type:

StateCookieParameter

Returns:

Constructed parameter schema.

_make_param_unrecognized(code, param=None, *, value=b'', **kwargs)[source]

Make SCTP unrecognized parameter parameter.

Parameters:
  • code (Parameter) – parameter type

  • param (UnrecognizedParameter | None) – parameter data

  • value (bytes) – the unrecognized parameter, complete with its type and length

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

UnrecognizedParameter

Returns:

Constructed parameter schema.

_make_param_preservative(code, param=None, *, increment=0, **kwargs)[source]

Make SCTP cookie preservative parameter.

Parameters:
Return type:

CookiePreservativeParameter

Returns:

Constructed parameter schema.

_make_param_hostname(code, param=None, *, name=b'\x00', **kwargs)[source]

Make SCTP host name address parameter.

Parameters:
Return type:

HostNameAddressParameter

Returns:

Constructed parameter schema.

Raises:

ProtocolError – If a user-supplied name is not null-terminated, as required by RFC 9260 Section 3.3.2.1.4.

Note

A parsed param carries its name as captured, so a name the reader accepted without a terminator rebuilds as read (#1482). The terminator check applies to name only.

_make_param_addrtypes(code, param=None, *, types=None, **kwargs)[source]

Make SCTP supported address types parameter.

Parameters:
Return type:

SupportedAddressTypesParameter

Returns:

Constructed parameter schema.

Raises:

ProtocolError – If an item of types is not a parameter type, as _make_param_types() checks.

_read_cause_donone(schema, *, causes)[source]

Read SCTP error cause of an unsupported cause code.

This is the fall-through for every error cause code pcapkit does not implement, e.g. those registered by SCTP extensions. The cause-specific information is recorded verbatim rather than raising.

Parameters:
Return type:

UnknownCause

Returns:

Parsed error cause data.

_read_cause_invalid_stream(schema, *, causes)[source]

Read SCTP invalid stream identifier error cause.

Structure of the cause [RFC 9260 Section 3.3.10.1]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Cause Code = 1         |       Cause Length = 8        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|       Stream Identifier       |          (Reserved)           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

InvalidStreamIdentifierCause

Returns:

Parsed error cause data.

Raises:

ProtocolError – If length is NOT 8.

_read_cause_missing_param(schema, *, causes)[source]

Read SCTP missing mandatory parameter error cause.

Structure of the cause [RFC 9260 Section 3.3.10.2]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Cause Code = 2         |   Cause Length = 8 + N * 2    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                 Number of missing params = N                  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Missing Param Type #1     |     Missing Param Type #2     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

MissingMandatoryParameterCause

Returns:

Parsed error cause data.

Raises:

ProtocolError – If length does NOT match the declared number of missing parameters.

Read SCTP stale cookie error cause.

Structure of the cause [RFC 9260 Section 3.3.10.3]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Cause Code = 3         |       Cause Length = 8        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                 Measure of Staleness (usec.)                  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

StaleCookieCause

Returns:

Parsed error cause data.

Raises:

ProtocolError – If length is NOT 8.

_read_cause_out_of_resource(schema, *, causes)[source]

Read SCTP out of resource error cause.

Structure of the cause [RFC 9260 Section 3.3.10.4]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Cause Code = 4         |       Cause Length = 4        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

OutOfResourceCause

Returns:

Parsed error cause data.

Raises:

ProtocolError – If length is NOT 4.

_read_cause_unresolvable_addr(schema, *, causes)[source]

Read SCTP unresolvable address error cause.

Structure of the cause [RFC 9260 Section 3.3.10.5]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Cause Code = 5         |         Cause Length          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/                     Unresolvable Address                      /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

UnresolvableAddressCause

Returns:

Parsed error cause data.

Raises:

ProtocolError – If length is NOT at least 4.

_read_cause_unrecognized_chunk(schema, *, causes)[source]

Read SCTP unrecognized chunk type error cause.

Structure of the cause [RFC 9260 Section 3.3.10.6]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Cause Code = 6         |         Cause Length          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/                      Unrecognized Chunk                       /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

UnrecognizedChunkTypeCause

Returns:

Parsed error cause data.

Raises:

ProtocolError – If length is NOT at least 4.

_read_cause_invalid_param(schema, *, causes)[source]

Read SCTP invalid mandatory parameter error cause.

Structure of the cause [RFC 9260 Section 3.3.10.7]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Cause Code = 7         |       Cause Length = 4        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

InvalidMandatoryParameterCause

Returns:

Parsed error cause data.

Raises:

ProtocolError – If length is NOT 4.

_read_cause_unrecognized_params(schema, *, causes)[source]

Read SCTP unrecognized parameters error cause.

Structure of the cause [RFC 9260 Section 3.3.10.8]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Cause Code = 8         |         Cause Length          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/                    Unrecognized Parameters                    /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

UnrecognizedParametersCause

Returns:

Parsed error cause data.

Raises:

ProtocolError – If length is NOT at least 4.

_read_cause_no_user_data(schema, *, causes)[source]

Read SCTP no user data error cause.

Structure of the cause [RFC 9260 Section 3.3.10.9]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Cause Code = 9         |       Cause Length = 8        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              TSN                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

NoUserDataCause

Returns:

Parsed error cause data.

Raises:

ProtocolError – If length is NOT 8.

Read SCTP cookie received while shutting down error cause.

Structure of the cause [RFC 9260 Section 3.3.10.10]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Cause Code = 10        |       Cause Length = 4        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

CookieReceivedWhileShuttingDownCause

Returns:

Parsed error cause data.

Raises:

ProtocolError – If length is NOT 4.

_read_cause_restart_addr(schema, *, causes)[source]

Read SCTP restart of an association with new addresses error cause.

Structure of the cause [RFC 9260 Section 3.3.10.11]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Cause Code = 11        |         Cause Length          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/                       New Address TLVs                        /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

RestartOfAnAssociationWithNewAddressesCause

Returns:

Parsed error cause data.

Raises:

ProtocolError – If length is NOT at least 4.

_read_cause_user_abort(schema, *, causes)[source]

Read SCTP user-initiated abort error cause.

Structure of the cause [RFC 9260 Section 3.3.10.12]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Cause Code = 12        |         Cause Length          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/                   Upper Layer Abort Reason                    /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

UserInitiatedAbortCause

Returns:

Parsed error cause data.

Raises:

ProtocolError – If length is NOT at least 4.

_read_cause_protocol_violation(schema, *, causes)[source]

Read SCTP protocol violation error cause.

Structure of the cause [RFC 9260 Section 3.3.10.13]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Cause Code = 13        |         Cause Length          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/                    Additional Information                     /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

ProtocolViolationCause

Returns:

Parsed error cause data.

Raises:

ProtocolError – If length is NOT at least 4.

_make_cause_donone(code, cause=None, *, value=b'', **kwargs)[source]

Make SCTP error cause of an unsupported cause code.

Parameters:
Return type:

UnknownCause

Returns:

Constructed error cause schema.

_make_cause_invalid_stream(code, cause=None, *, stream_id=0, reserved=b'\x00\x00', **kwargs)[source]

Make SCTP invalid stream identifier error cause.

Parameters:
  • code (CauseCode) – error cause code

  • cause (InvalidStreamIdentifierCause | None) – error cause data

  • stream_id (int) – stream identifier of the offending DATA chunk

  • reserved (bytes) – reserved field, as two bytes

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

InvalidStreamIdentifierCause

Returns:

Constructed error cause schema.

Raises:

ProtocolError – If reserved is NOT exactly two bytes.

_make_cause_missing_param(code, cause=None, *, types=None, **kwargs)[source]

Make SCTP missing mandatory parameter error cause.

Parameters:
Return type:

MissingMandatoryParameterCause

Returns:

Constructed error cause schema.

Raises:

ProtocolError – If an item of types is not a parameter type, as _make_param_types() checks.

Note

The count of missing parameters is derived from types rather than taken as an argument, so that it cannot disagree with the list it counts.

Make SCTP stale cookie error cause.

Parameters:
  • code (CauseCode) – error cause code

  • cause (StaleCookieCause | None) – error cause data

  • staleness (int) – measure of staleness, in microseconds

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

StaleCookieCause

Returns:

Constructed error cause schema.

_make_cause_out_of_resource(code, cause=None, **kwargs)[source]

Make SCTP out of resource error cause.

Parameters:
Return type:

OutOfResourceCause

Returns:

Constructed error cause schema.

_make_cause_unresolvable_addr(code, cause=None, *, value=b'', **kwargs)[source]

Make SCTP unresolvable address error cause.

Parameters:
  • code (CauseCode) – error cause code

  • cause (UnresolvableAddressCause | None) – error cause data

  • value (bytes) – the offending address parameter, complete with its type and length

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

UnresolvableAddressCause

Returns:

Constructed error cause schema.

_make_cause_unrecognized_chunk(code, cause=None, *, value=b'', **kwargs)[source]

Make SCTP unrecognized chunk type error cause.

Parameters:
Return type:

UnrecognizedChunkTypeCause

Returns:

Constructed error cause schema.

_make_cause_invalid_param(code, cause=None, **kwargs)[source]

Make SCTP invalid mandatory parameter error cause.

Parameters:
Return type:

InvalidMandatoryParameterCause

Returns:

Constructed error cause schema.

_make_cause_unrecognized_params(code, cause=None, *, value=b'', **kwargs)[source]

Make SCTP unrecognized parameters error cause.

Parameters:
Return type:

UnrecognizedParametersCause

Returns:

Constructed error cause schema.

_make_cause_no_user_data(code, cause=None, *, tsn=0, **kwargs)[source]

Make SCTP no user data error cause.

Parameters:
  • code (CauseCode) – error cause code

  • cause (NoUserDataCause | None) – error cause data

  • tsn (int) – TSN of the offending DATA chunk

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

NoUserDataCause

Returns:

Constructed error cause schema.

Make SCTP cookie received while shutting down error cause.

Parameters:
Return type:

CookieReceivedWhileShuttingDownCause

Returns:

Constructed error cause schema.

_make_cause_restart_addr(code, cause=None, *, value=b'', **kwargs)[source]

Make SCTP restart of an association with new addresses error cause.

Parameters:
Return type:

RestartOfAnAssociationWithNewAddressesCause

Returns:

Constructed error cause schema.

_make_cause_user_abort(code, cause=None, *, info=b'', **kwargs)[source]

Make SCTP user-initiated abort error cause.

Parameters:
Return type:

UserInitiatedAbortCause

Returns:

Constructed error cause schema.

_make_cause_protocol_violation(code, cause=None, *, info=b'', **kwargs)[source]

Make SCTP protocol violation error cause.

Parameters:
Return type:

ProtocolViolationCause

Returns:

Constructed error cause schema.

__proto__: DefaultDict[int, ModuleDescriptor[ProtocolBase] | Type[ProtocolBase]]

Protocol index mapping for decoding next layer, see self._decode_next_layer & self._import_next_layer.

Important

Keyed by the DATA chunk’s payload protocol identifier (PPID), not by port number as in TCP and UDP.

__proto_key__: ClassVar[tuple[Type[EnumRegistry], bool]]

the enum a key must be a member of, and whether a bare int is a valid key there too. Declared by the class owning the registry, and read from it by register_protocol_code() so a code= key is checked exactly as register_sctp() checks its own – a bare int is accepted because the registry is keyed by payload protocol identifier, which is a number in its own right (#2268).

Type:

What __proto__ is keyed by

__chunk__: DefaultDict[int, str | tuple[Callable[[Chunk, OrderedMultiDict[Chunk, Chunk]], Chunk], Callable[[Chunk, Chunk | None, Any], Chunk]]]

Chunk type to method mapping, see _read_sctp_chunks() and _make_sctp_chunks(). A str value names the methods _read_chunk_${name} and _make_chunk_${name}, falling back to _read_chunk_donone() and _make_chunk_donone() when the class has no such method; any other value is a (parser, constructor) pair of callables.

__parameter__: DefaultDict[int, str | tuple[Callable[[Parameter, OrderedMultiDict[Parameter, Parameter]], Parameter], Callable[[Parameter, Parameter | None, Any], Parameter]]]

Chunk parameter type to method mapping, see _read_sctp_parameters() and _make_sctp_parameters(). A str value names the methods _read_param_${name} and _make_param_${name}, falling back to _read_param_donone() and _make_param_donone() when the class has no such method; any other value is a (parser, constructor) pair of callables.

__cause__: DefaultDict[int, str | tuple[Callable[[ErrorCause, OrderedMultiDict[CauseCode, ErrorCause]], ErrorCause], Callable[[CauseCode, ErrorCause | None, Any], ErrorCause]]]

Error cause code to method mapping, see _read_sctp_causes() and _make_sctp_causes(). A str value names the methods _read_cause_${name} and _make_cause_${name}, falling back to _read_cause_donone() and _make_cause_donone() when the class has no such method; any other value is a (parser, constructor) pair of callables.

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.transport.sctp.SCTP(srcport=NO_VALUE, dstport=NO_VALUE, vtag=NO_VALUE, chksum=NO_VALUE, chunks=NO_VALUE, trailer=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Schema

Header schema for SCTP packets.

Note

Unlike TCP and UDP, there is no payload field, since SCTP carries its user data inside DATA chunks rather than after the common header. See SCTP._get_payload for how the next layer is located.

srcport: AppType = <PortEnumField srcport>

Source port.

dstport: AppType = <PortEnumField dstport>

Destination port.

vtag: int = <UInt32Field vtag>

Verification tag.

chksum: bytes = <BytesField chksum>

Checksum, as a CRC32c over the whole packet with this field zeroed.

chunks: list[Chunk] = <ChunkListField chunks>

Chunks.

trailer: bytes = <PayloadField trailer>

Octets captured after the last whole chunk, see ChunkListField and IPv4.trailer.

class pcapkit.protocols.schema.transport.sctp.Chunk(*args, **kwargs)[source]

Bases: EnumSchema[Chunk]

Header schema for SCTP chunks.

type: Chunk = <EnumField type>

Chunk type.

flags: bytes = <BytesField flags>

Chunk flags, whose meaning depends on the chunk type.

length: int = <UInt16Field length>

Chunk length, excluding any trailing padding.

pre_pack(packet)[source]

Prepare packet data for packing process; see pre_pack_padding().

class pcapkit.protocols.schema.transport.sctp.UnknownChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, value=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Chunk

Header schema for SCTP chunks with unknown types.

value: bytes = <BytesField value>

Chunk value.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.DATAChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, tsn=NO_VALUE, stream_id=NO_VALUE, stream_seq=NO_VALUE, ppid=NO_VALUE, data=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Chunk

Header schema for SCTP DATA chunks.

flags: DATAChunkFlags = <BitField flags>

Chunk flags.

tsn: int = <UInt32Field tsn>

Transmission sequence number.

stream_id: int = <UInt16Field stream_id>

Stream identifier.

stream_seq: int = <UInt16Field stream_seq>

Stream sequence number.

ppid: PayloadProtocolIdentifier = <EnumField ppid>

Payload protocol identifier.

data: bytes = <BytesField data>

User data.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.INITChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, init_tag=NO_VALUE, a_rwnd=NO_VALUE, outbound_streams=NO_VALUE, inbound_streams=NO_VALUE, init_tsn=NO_VALUE, parameters=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Chunk

Header schema for SCTP INIT chunks.

init_tag: int = <UInt32Field init_tag>

Initiate tag.

a_rwnd: int = <UInt32Field a_rwnd>

Advertised receiver window credit.

outbound_streams: int = <UInt16Field outbound_streams>

Number of outbound streams.

inbound_streams: int = <UInt16Field inbound_streams>

Number of inbound streams.

init_tsn: int = <UInt32Field init_tsn>

Initial transmission sequence number.

parameters: list[Parameter] = <OptionField parameters>

Optional and variable-length parameters, including the chunk’s own trailing padding; see nested_length().

class pcapkit.protocols.schema.transport.sctp.INITACKChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, init_tag=NO_VALUE, a_rwnd=NO_VALUE, outbound_streams=NO_VALUE, inbound_streams=NO_VALUE, init_tsn=NO_VALUE, parameters=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Chunk

Header schema for SCTP INIT ACK chunks.

init_tag: int = <UInt32Field init_tag>

Initiate tag.

a_rwnd: int = <UInt32Field a_rwnd>

Advertised receiver window credit.

outbound_streams: int = <UInt16Field outbound_streams>

Number of outbound streams.

inbound_streams: int = <UInt16Field inbound_streams>

Number of inbound streams.

init_tsn: int = <UInt32Field init_tsn>

Initial transmission sequence number.

parameters: list[Parameter] = <OptionField parameters>

Optional and variable-length parameters, including the chunk’s own trailing padding; see nested_length().

class pcapkit.protocols.schema.transport.sctp.SACKChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, cum_tsn_ack=NO_VALUE, a_rwnd=NO_VALUE, num_gap_blocks=NO_VALUE, num_dup_tsn=NO_VALUE, gap_blocks=NO_VALUE, dup_tsn=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Chunk

Header schema for SCTP SACK chunks.

cum_tsn_ack: int = <UInt32Field cum_tsn_ack>

Cumulative TSN ack.

a_rwnd: int = <UInt32Field a_rwnd>

Advertised receiver window credit.

num_gap_blocks: int = <UInt16Field num_gap_blocks>

Number of gap ack blocks.

num_dup_tsn: int = <UInt16Field num_dup_tsn>

Number of duplicate TSNs.

gap_blocks: list[GapAckBlock] = <ListField gap_blocks>

Gap ack blocks.

dup_tsn: list[int] = <ListField dup_tsn>

Duplicate TSNs.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.HeartbeatChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, parameters=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Chunk

Header schema for SCTP HEARTBEAT chunks.

parameters: list[Parameter] = <OptionField parameters>

Heartbeat information parameters, including the chunk’s own trailing padding; see nested_length().

class pcapkit.protocols.schema.transport.sctp.HeartbeatACKChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, parameters=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Chunk

Header schema for SCTP HEARTBEAT ACK chunks.

parameters: list[Parameter] = <OptionField parameters>

Heartbeat information parameters, including the chunk’s own trailing padding; see nested_length().

class pcapkit.protocols.schema.transport.sctp.AbortChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, error=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Chunk

Header schema for SCTP ABORT chunks.

flags: TBitFlags = <BitField flags>

Chunk flags.

error: list[ErrorCause] = <OptionField error>

Zero or more error causes, including the chunk’s own trailing padding; see nested_length().

class pcapkit.protocols.schema.transport.sctp.ShutdownChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, cum_tsn_ack=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Chunk

Header schema for SCTP SHUTDOWN chunks.

cum_tsn_ack: int = <UInt32Field cum_tsn_ack>

Cumulative TSN ack.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.ShutdownACKChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Chunk

Header schema for SCTP SHUTDOWN ACK chunks.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.ErrorChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, error=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Chunk

Header schema for SCTP ERROR chunks.

error: list[ErrorCause] = <OptionField error>

One or more error causes, including the chunk’s own trailing padding; see nested_length().

class pcapkit.protocols.schema.transport.sctp.CookieEchoChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, cookie=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Chunk

Header schema for SCTP COOKIE ECHO chunks.

cookie: bytes = <BytesField cookie>

State cookie, as received in the INIT ACK chunk’s state cookie parameter.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.CookieACKChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Chunk

Header schema for SCTP COOKIE ACK chunks.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.ShutdownCompleteChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Chunk

Header schema for SCTP SHUTDOWN COMPLETE chunks.

flags: TBitFlags = <BitField flags>

Chunk flags.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.GapAckBlock(start=NO_VALUE, end=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Schema

Header schema for SCTP SACK chunk gap ack blocks.

start: int = <UInt16Field start>

Start offset TSN of the gap ack block.

end: int = <UInt16Field end>

End offset TSN of the gap ack block.

class pcapkit.protocols.schema.transport.sctp.Parameter(*args, **kwargs)[source]

Bases: EnumSchema[Parameter]

Header schema for SCTP chunk parameters.

type: Parameter = <EnumField type>

Parameter type.

length: int = <UInt16Field length>

Parameter length.

pre_pack(packet)[source]

Prepare packet data for packing process; see pre_pack_padding().

class pcapkit.protocols.schema.transport.sctp.UnknownParameter(type=NO_VALUE, length=NO_VALUE, value=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Parameter

Header schema for SCTP chunk parameters with unknown types.

value: bytes = <BytesField value>

Parameter value.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.HeartbeatInfoParameter(type=NO_VALUE, length=NO_VALUE, info=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Parameter

Header schema for SCTP heartbeat info parameter.

info: bytes = <BytesField info>

Sender-specific heartbeat info.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.IPv4AddressParameter(type=NO_VALUE, length=NO_VALUE, address=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Parameter

Header schema for SCTP IPv4 address parameter.

address: IPv4Address = <IPv4AddressField address>

IPv4 address of the sending endpoint.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.IPv6AddressParameter(type=NO_VALUE, length=NO_VALUE, address=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Parameter

Header schema for SCTP IPv6 address parameter.

address: IPv6Address = <IPv6AddressField address>

IPv6 address of the sending endpoint.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.StateCookieParameter(type=NO_VALUE, length=NO_VALUE, cookie=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Parameter

Header schema for SCTP state cookie parameter.

cookie: bytes = <BytesField cookie>

State cookie.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.UnrecognizedParameter(type=NO_VALUE, length=NO_VALUE, value=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Parameter

Header schema for SCTP unrecognized parameter parameter.

value: bytes = <BytesField value>

The unrecognized parameter, complete with its type and length.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.CookiePreservativeParameter(type=NO_VALUE, length=NO_VALUE, increment=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Parameter

Header schema for SCTP cookie preservative parameter.

increment: int = <UInt32Field increment>

Suggested cookie life-span increment, in milliseconds.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.HostNameAddressParameter(type=NO_VALUE, length=NO_VALUE, name=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Parameter

Header schema for SCTP host name address parameter.

name: bytes = <BytesField name>

Host name as captured. RFC 9260 Section 3.3.2.1.4 asks for at least one null terminator, but a parsed name may lack it.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.SupportedAddressTypesParameter(type=NO_VALUE, length=NO_VALUE, types=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Parameter

Header schema for SCTP supported address types parameter.

types: list[Parameter] = <ListField types>

Supported address types, given as address parameter types.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.ErrorCause(*args, **kwargs)[source]

Bases: EnumSchema[CauseCode]

Header schema for SCTP error causes.

code: CauseCode = <EnumField code>

Cause code.

length: int = <UInt16Field length>

Cause length.

pre_pack(packet)[source]

Prepare packet data for packing process; see pre_pack_padding().

class pcapkit.protocols.schema.transport.sctp.UnknownCause(code=NO_VALUE, length=NO_VALUE, value=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ErrorCause

Header schema for SCTP error causes with unknown cause codes.

value: bytes = <BytesField value>

Cause-specific information.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.InvalidStreamIdentifierCause(code=NO_VALUE, length=NO_VALUE, stream_id=NO_VALUE, reserved=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ErrorCause

Header schema for SCTP invalid stream identifier error cause.

stream_id: int = <UInt16Field stream_id>

Stream identifier of the offending DATA chunk.

reserved: bytes = <BytesField reserved>

Reserved.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.MissingMandatoryParameterCause(code=NO_VALUE, length=NO_VALUE, num=NO_VALUE, types=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ErrorCause

Header schema for SCTP missing mandatory parameter error cause.

num: int = <UInt32Field num>

Number of missing parameters.

types: list[Parameter] = <ListField types>

Missing parameter types.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.StaleCookieCause(code=NO_VALUE, length=NO_VALUE, staleness=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ErrorCause

Header schema for SCTP stale cookie error cause.

staleness: int = <UInt32Field staleness>

Measure of staleness, in microseconds.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.OutOfResourceCause(code=NO_VALUE, length=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ErrorCause

Header schema for SCTP out of resource error cause.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.UnresolvableAddressCause(code=NO_VALUE, length=NO_VALUE, value=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ErrorCause

Header schema for SCTP unresolvable address error cause.

value: bytes = <BytesField value>

The offending address parameter, complete with its type and length.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.UnrecognizedChunkTypeCause(code=NO_VALUE, length=NO_VALUE, value=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ErrorCause

Header schema for SCTP unrecognized chunk type error cause.

value: bytes = <BytesField value>

The unrecognized chunk, complete with its type, flags and length.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.InvalidMandatoryParameterCause(code=NO_VALUE, length=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ErrorCause

Header schema for SCTP invalid mandatory parameter error cause.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.UnrecognizedParametersCause(code=NO_VALUE, length=NO_VALUE, value=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ErrorCause

Header schema for SCTP unrecognized parameters error cause.

value: bytes = <BytesField value>

The unrecognized parameters, complete with their types and lengths.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.NoUserDataCause(code=NO_VALUE, length=NO_VALUE, tsn=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ErrorCause

Header schema for SCTP no user data error cause.

tsn: int = <UInt32Field tsn>

TSN of the offending DATA chunk.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.CookieReceivedWhileShuttingDownCause(code=NO_VALUE, length=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ErrorCause

Header schema for SCTP cookie received while shutting down error cause.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.RestartOfAnAssociationWithNewAddressesCause(code=NO_VALUE, length=NO_VALUE, value=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ErrorCause

Header schema for SCTP restart of an association with new addresses error cause.

value: bytes = <BytesField value>

The new address parameters, complete with their types and lengths.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.UserInitiatedAbortCause(code=NO_VALUE, length=NO_VALUE, info=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ErrorCause

Header schema for SCTP user-initiated abort error cause.

info: bytes = <BytesField info>

Upper layer abort reason.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.ProtocolViolationCause(code=NO_VALUE, length=NO_VALUE, info=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ErrorCause

Header schema for SCTP protocol violation error cause.

info: bytes = <BytesField info>

Additional information.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.ChunkListField(length=lambda _: ..., base_schema=None, type_name='type', registry=None, eool=None, callback=lambda *_: ...)[source]

Bases: OptionField

Chunk list that stops at the last whole chunk.

SCTP has no packet length field, so octets after the last whole chunk – fewer than a chunk header, or a chunk whose length runs past the data – cannot be told apart from a chunk cut short. They are not parsed but reported as option padding, which Schema.unpack hands back to the stream for SCTP.trailer to keep as captured (#1468).

unpack(buffer, packet)[source]

Unpack field value from bytes.

Parameters:
Return type:

list[Chunk]

Returns:

Unpacked whole chunks.

Type Stubs

class pcapkit.protocols.schema.transport.sctp.DATAChunkFlags[source]

Bases: TypedDict

SCTP DATA chunk flags.

reserved: int

Reserved bits.

I: int

(I)mmediate bit, i.e., request a SACK chunk without delay.

U: int

(U)nordered bit, i.e., no stream sequence number is assigned.

B: int

(B)eginning fragment bit.

E: int

(E)nding fragment bit.

class pcapkit.protocols.schema.transport.sctp.TBitFlags[source]

Bases: TypedDict

SCTP chunk flags carrying only the T bit, i.e., ABORT and SHUTDOWN COMPLETE chunks.

reserved: int

Reserved bits.

T: int

T bit, i.e., the verification tag has been reflected.

Auxiliary Functions

pcapkit.protocols.schema.transport.sctp.padding_length(pkt)[source]

Length of the trailing padding of an SCTP type-length-value structure.

Chunks, chunk parameters and error causes are all padded with all-zero bytes to a multiple of four bytes, and per RFC 9260 Section 3.2 that padding is not counted in the length field. The padding is still on the wire, though, so it has to be consumed for the enclosing list to stay aligned.

Parameters:

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

Return type:

int

Returns:

Number of padding bytes, clamped to the number of bytes left in the enclosing structure, so that a final chunk captured without (all of) its padding still parses, although RFC 9260 Section 3.2 has the sender pad every chunk. When packing, it is clamped as well to the __padding__ width pre_pack_padding() hands over, so a final chunk captured without (all of) its padding rebuilds without it (#1474).

pcapkit.protocols.schema.transport.sctp.pre_pack_padding(schema, packet)[source]

Hand a schema’s recorded padding width to padding_length().

Parameters:
  • schema (Schema) – Chunk, parameter or error cause being packed.

  • packet (dict[str, Any]) – Packet data, shared with the enclosing and sibling schemas.

A schema whose padding was captured short – only the last chunk of a packet can be – carries the width as captured under __padding__ in its __dict__, set by _restore_padding in pcapkit.protocols.transport.sctp from the chunk’s padding as parsed (#1474). The key is written to packet for every schema, None when there is no record, since Schema.pack shares one packet mapping across siblings and a record left behind by one would otherwise shorten the padding of the next.

pcapkit.protocols.schema.transport.sctp.bounded(length)[source]

Clamp a list field’s computed length to the bytes actually available.

Parameters:

length (Callable[[dict[str, Any]], int]) – Callback computing the field’s nominal length.

Return type:

Callable[[dict[str, Any]], int]

Returns:

A callback returning that length, never exceeding the bytes left in the enclosing structure.

A count field and the list it counts can disagree on a malformed packet, and ListField.unpack subtracts the parsed size of each item from its budget – so a SchemaField item that runs out of bytes parses to nothing, subtracts nothing, and the loop never terminates. Clamping to the bytes on hand turns that hang into a short list, which the read handlers then reject against the declared length.

Only list fields are wrapped: ListField.pack ignores the length entirely, so clamping cannot truncate anything on construction.

pcapkit.protocols.schema.transport.sctp.nested_length(base)[source]

Build a length callback for a chunk’s nested type-length-value list.

Parameters:

base (int) – Size of the chunk’s fixed-length fields, including the four-byte chunk header.

Return type:

Callable[[dict[str, Any]], int]

Returns:

A callback returning the size of the chunk’s nested list including the chunk’s own trailing padding.

The chunks that carry a nested list – INIT, INIT ACK, HEARTBEAT, HEARTBEAT ACK, ABORT and ERROR – deliberately have no separate PaddingField, and fold the chunk’s trailing padding into the nested list’s own span instead, which parsing and construction each need for a reason of their own:

  • On parsing, a sender is allowed by RFC 9260 Section 3.2 to leave the final parameter’s padding out of the chunk length, so the padding has to be consumed whether or not the length accounts for it. Folding it into the list’s span does that, and leaves it visible as the field’s __option_padding__. The last chunk of a packet may omit that padding altogether, so the chunks wrap this callback in bounded(): the span then ends with the data, and the final parameter or cause reads only the padding that is there (#1479).

  • On construction, a separate padding field could not compute its own size: Schema.pack passes one shared packet mapping down into the nested schemas, and each nested parameter overwrites packet['length'] with its length, so a trailing field would size itself from the last parameter rather than from the chunk. Folding avoids the question: every nested parameter packs its own padding, the last one’s included, so the list already ends on a four-byte boundary whether or not the chunk length counts that final padding.

pcapkit.protocols.schema.transport.sctp.whole_chunks_length(data)[source]

Length of the run of whole chunks at the front of data.

Parameters:

data (bytes) – Chunk area of an SCTP packet.

Return type:

int

Returns:

Number of octets up to the end of the last chunk whose declared length octets are all present, with as much of its padding as there is, see padding_length(). A length below the four-octet chunk header (RFC 9260 Section 3.2) delimits nothing, so the run stops there too; four zero octets would otherwise read as a DATA chunk.

Data Models

class pcapkit.protocols.data.transport.sctp.SCTP(srcport, dstport, vtag, chksum, chunks)[source]

Bases: Protocol

Data model for SCTP packet.

srcport: AppType

Source port.

dstport: AppType

Destination port.

vtag: int

Verification tag.

chksum: bytes

Checksum, as a CRC32c over the whole packet with this field zeroed.

chunks: OrderedMultiInfo[Chunk, Chunk]

Chunks.

trailer: bytes

Octets captured after the last whole chunk, present only when there are any.

class pcapkit.protocols.data.transport.sctp.DATAChunkFlags(reserved, I, U, B, E)[source]

Bases: Data

Data model for SCTP DATA chunk flags.

reserved: int

Reserved bits, kept as received.

I: bool

(I)mmediate bit, i.e., request a SACK chunk without delay.

U: bool

(U)nordered bit, i.e., no stream sequence number is assigned.

B: bool

(B)eginning fragment bit.

E: bool

(E)nding fragment bit.

class pcapkit.protocols.data.transport.sctp.TBitFlags(reserved, T)[source]

Bases: Data

Data model for SCTP chunk flags carrying only the T bit, i.e., ABORT and SHUTDOWN COMPLETE chunks.

reserved: int

Reserved bits, kept as received.

T: bool

T bit, i.e., the verification tag has been reflected.

class pcapkit.protocols.data.transport.sctp.GapAckBlock(start, end)[source]

Bases: Data

Data model for SCTP SACK chunk gap ack blocks.

start: int

Start offset TSN of the gap ack block.

end: int

End offset TSN of the gap ack block.

class pcapkit.protocols.data.transport.sctp.Chunk(*args, **kwargs)[source]

Bases: Data

Data model for SCTP chunks.

type: Chunk

Chunk type.

length: int

Chunk length, excluding any trailing padding.

padding: bytes

Trailing padding octets, as captured; present only when they are not all zeros, or fewer than the length calls for (#1474). Read back by from_data only, where fewer octets are honoured on the last item of its list alone and zero-filled to the full width anywhere else. make builds from keywords and takes no padding: every item it builds is padded in zeros.

class pcapkit.protocols.data.transport.sctp.UnknownChunk(type, length, flags, value)[source]

Bases: Chunk

Data model for SCTP chunks with unknown types.

flags: bytes

Raw chunk flags.

value: bytes

Chunk value.

class pcapkit.protocols.data.transport.sctp.DATAChunk(type, length, flags, tsn, stream_id, stream_seq, ppid, data)[source]

Bases: Chunk

Data model for SCTP DATA chunks.

flags: DATAChunkFlags

Chunk flags.

tsn: int

Transmission sequence number.

stream_id: int

Stream identifier.

stream_seq: int

Stream sequence number.

ppid: PayloadProtocolIdentifier

Payload protocol identifier.

data: bytes

User data.

class pcapkit.protocols.data.transport.sctp.INITChunk(type, length, flags, init_tag, a_rwnd, outbound_streams, inbound_streams, init_tsn, parameters)[source]

Bases: Chunk

Data model for SCTP INIT chunks.

flags: bytes

Raw chunk flags, kept as received.

init_tag: int

Initiate tag.

a_rwnd: int

Advertised receiver window credit.

outbound_streams: int

Number of outbound streams.

inbound_streams: int

Number of inbound streams.

init_tsn: int

Initial transmission sequence number.

parameters: OrderedMultiInfo[Parameter, Parameter]

Optional and variable-length parameters.

class pcapkit.protocols.data.transport.sctp.INITACKChunk(type, length, flags, init_tag, a_rwnd, outbound_streams, inbound_streams, init_tsn, parameters)[source]

Bases: Chunk

Data model for SCTP INIT ACK chunks.

flags: bytes

Raw chunk flags, kept as received.

init_tag: int

Initiate tag.

a_rwnd: int

Advertised receiver window credit.

outbound_streams: int

Number of outbound streams.

inbound_streams: int

Number of inbound streams.

init_tsn: int

Initial transmission sequence number.

parameters: OrderedMultiInfo[Parameter, Parameter]

Optional and variable-length parameters.

class pcapkit.protocols.data.transport.sctp.SACKChunk(type, length, flags, cum_tsn_ack, a_rwnd, num_gap_blocks, num_dup_tsn, gap_blocks, dup_tsn)[source]

Bases: Chunk

Data model for SCTP SACK chunks.

flags: bytes

Raw chunk flags, kept as received.

cum_tsn_ack: int

Cumulative TSN ack.

a_rwnd: int

Advertised receiver window credit.

num_gap_blocks: int

Number of gap ack blocks.

num_dup_tsn: int

Number of duplicate TSNs.

gap_blocks: tuple[GapAckBlock, ...]

Gap ack blocks.

dup_tsn: tuple[int, ...]

Duplicate TSNs.

class pcapkit.protocols.data.transport.sctp.HeartbeatChunk(type, length, flags, parameters)[source]

Bases: Chunk

Data model for SCTP HEARTBEAT chunks.

flags: bytes

Raw chunk flags, kept as received.

parameters: OrderedMultiInfo[Parameter, Parameter]

Heartbeat information parameters.

class pcapkit.protocols.data.transport.sctp.HeartbeatACKChunk(type, length, flags, parameters)[source]

Bases: Chunk

Data model for SCTP HEARTBEAT ACK chunks.

flags: bytes

Raw chunk flags, kept as received.

parameters: OrderedMultiInfo[Parameter, Parameter]

Heartbeat information parameters.

class pcapkit.protocols.data.transport.sctp.AbortChunk(type, length, flags, error)[source]

Bases: Chunk

Data model for SCTP ABORT chunks.

flags: TBitFlags

Chunk flags.

error: OrderedMultiInfo[CauseCode, ErrorCause]

Zero or more error causes.

class pcapkit.protocols.data.transport.sctp.ShutdownChunk(type, length, flags, cum_tsn_ack)[source]

Bases: Chunk

Data model for SCTP SHUTDOWN chunks.

flags: bytes

Raw chunk flags, kept as received.

cum_tsn_ack: int

Cumulative TSN ack.

class pcapkit.protocols.data.transport.sctp.ShutdownACKChunk(type, length, flags)[source]

Bases: Chunk

Data model for SCTP SHUTDOWN ACK chunks.

flags: bytes

Raw chunk flags, kept as received.

class pcapkit.protocols.data.transport.sctp.ErrorChunk(type, length, flags, error)[source]

Bases: Chunk

Data model for SCTP ERROR chunks.

flags: bytes

Raw chunk flags, kept as received.

error: OrderedMultiInfo[CauseCode, ErrorCause]

One or more error causes.

class pcapkit.protocols.data.transport.sctp.CookieEchoChunk(type, length, flags, cookie)[source]

Bases: Chunk

Data model for SCTP COOKIE ECHO chunks.

flags: bytes

Raw chunk flags, kept as received.

cookie: bytes

State cookie, as received in the INIT ACK chunk’s state cookie parameter.

class pcapkit.protocols.data.transport.sctp.CookieACKChunk(type, length, flags)[source]

Bases: Chunk

Data model for SCTP COOKIE ACK chunks.

flags: bytes

Raw chunk flags, kept as received.

class pcapkit.protocols.data.transport.sctp.ShutdownCompleteChunk(type, length, flags)[source]

Bases: Chunk

Data model for SCTP SHUTDOWN COMPLETE chunks.

flags: TBitFlags

Chunk flags.

class pcapkit.protocols.data.transport.sctp.Parameter(*args, **kwargs)[source]

Bases: Data

Data model for SCTP chunk parameters.

type: Parameter

Parameter type.

length: int

Parameter length.

padding: bytes

Trailing padding octets, as captured; present only when they are not all zeros, or fewer than the length calls for (#1474). Read back by from_data only, where fewer octets are honoured on the last item of its list alone and zero-filled to the full width anywhere else. make builds from keywords and takes no padding: every item it builds is padded in zeros.

class pcapkit.protocols.data.transport.sctp.UnknownParameter(type, length, value)[source]

Bases: Parameter

Data model for SCTP chunk parameters with unknown types.

value: bytes

Parameter value.

class pcapkit.protocols.data.transport.sctp.HeartbeatInfoParameter(type, length, info)[source]

Bases: Parameter

Data model for SCTP heartbeat info parameter.

info: bytes

Sender-specific heartbeat info.

class pcapkit.protocols.data.transport.sctp.IPv4AddressParameter(type, length, address)[source]

Bases: Parameter

Data model for SCTP IPv4 address parameter.

address: IPv4Address

IPv4 address of the sending endpoint.

class pcapkit.protocols.data.transport.sctp.IPv6AddressParameter(type, length, address)[source]

Bases: Parameter

Data model for SCTP IPv6 address parameter.

address: IPv6Address

IPv6 address of the sending endpoint.

class pcapkit.protocols.data.transport.sctp.StateCookieParameter(type, length, cookie)[source]

Bases: Parameter

Data model for SCTP state cookie parameter.

cookie: bytes

State cookie.

class pcapkit.protocols.data.transport.sctp.UnrecognizedParameter(type, length, value)[source]

Bases: Parameter

Data model for SCTP unrecognized parameter parameter.

value: bytes

The unrecognized parameter, complete with its type and length.

class pcapkit.protocols.data.transport.sctp.CookiePreservativeParameter(type, length, increment)[source]

Bases: Parameter

Data model for SCTP cookie preservative parameter.

increment: int

Suggested cookie life-span increment, in milliseconds.

class pcapkit.protocols.data.transport.sctp.HostNameAddressParameter(type, length, name)[source]

Bases: Parameter

Data model for SCTP host name address parameter.

name: bytes

Host name as captured, with any null terminator; a parsed name may lack one.

class pcapkit.protocols.data.transport.sctp.SupportedAddressTypesParameter(type, length, types)[source]

Bases: Parameter

Data model for SCTP supported address types parameter.

types: tuple[Parameter, ...]

Supported address types, given as address parameter types.

class pcapkit.protocols.data.transport.sctp.ErrorCause(*args, **kwargs)[source]

Bases: Data

Data model for SCTP error causes.

code: CauseCode

Cause code.

length: int

Cause length.

padding: bytes

Trailing padding octets, as captured; present only when they are not all zeros, or fewer than the length calls for (#1474). Read back by from_data only, where fewer octets are honoured on the last item of its list alone and zero-filled to the full width anywhere else. make builds from keywords and takes no padding: every item it builds is padded in zeros.

class pcapkit.protocols.data.transport.sctp.UnknownCause(code, length, value)[source]

Bases: ErrorCause

Data model for SCTP error causes with unknown cause codes.

value: bytes

Cause-specific information.

class pcapkit.protocols.data.transport.sctp.InvalidStreamIdentifierCause(code, length, stream_id, reserved)[source]

Bases: ErrorCause

Data model for SCTP invalid stream identifier error cause.

stream_id: int

Stream identifier of the offending DATA chunk.

reserved: bytes

Reserved field, kept as received.

class pcapkit.protocols.data.transport.sctp.MissingMandatoryParameterCause(code, length, num, types)[source]

Bases: ErrorCause

Data model for SCTP missing mandatory parameter error cause.

num: int

Number of missing parameters.

types: tuple[Parameter, ...]

Missing parameter types.

class pcapkit.protocols.data.transport.sctp.StaleCookieCause(code, length, staleness)[source]

Bases: ErrorCause

Data model for SCTP stale cookie error cause.

staleness: int

Measure of staleness, in microseconds.

class pcapkit.protocols.data.transport.sctp.OutOfResourceCause(code, length)[source]

Bases: ErrorCause

Data model for SCTP out of resource error cause.

class pcapkit.protocols.data.transport.sctp.UnresolvableAddressCause(code, length, value)[source]

Bases: ErrorCause

Data model for SCTP unresolvable address error cause.

value: bytes

The offending address parameter, complete with its type and length.

class pcapkit.protocols.data.transport.sctp.UnrecognizedChunkTypeCause(code, length, value)[source]

Bases: ErrorCause

Data model for SCTP unrecognized chunk type error cause.

value: bytes

The unrecognized chunk, complete with its type, flags and length.

class pcapkit.protocols.data.transport.sctp.InvalidMandatoryParameterCause(code, length)[source]

Bases: ErrorCause

Data model for SCTP invalid mandatory parameter error cause.

class pcapkit.protocols.data.transport.sctp.UnrecognizedParametersCause(code, length, value)[source]

Bases: ErrorCause

Data model for SCTP unrecognized parameters error cause.

value: bytes

The unrecognized parameters, complete with their types and lengths.

class pcapkit.protocols.data.transport.sctp.NoUserDataCause(code, length, tsn)[source]

Bases: ErrorCause

Data model for SCTP no user data error cause.

tsn: int

TSN of the offending DATA chunk.

class pcapkit.protocols.data.transport.sctp.CookieReceivedWhileShuttingDownCause(code, length)[source]

Bases: ErrorCause

Data model for SCTP cookie received while shutting down error cause.

class pcapkit.protocols.data.transport.sctp.RestartOfAnAssociationWithNewAddressesCause(code, length, value)[source]

Bases: ErrorCause

Data model for SCTP restart of an association with new addresses error cause.

value: bytes

The new address parameters, complete with their types and lengths.

class pcapkit.protocols.data.transport.sctp.UserInitiatedAbortCause(code, length, info)[source]

Bases: ErrorCause

Data model for SCTP user-initiated abort error cause.

info: bytes

Upper layer abort reason.

class pcapkit.protocols.data.transport.sctp.ProtocolViolationCause(code, length, info)[source]

Bases: ErrorCause

Data model for SCTP protocol violation error cause.

info: bytes

Additional information.

Footnotes