SCTP - Stream Control Transmission Protocol

pcapkit.protocols.transport.sctp contains SCTP only, which implements 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():

>>> SCTP.register(Enum_PayloadProtocolIdentifier.PayloadProtocolIdentifier_3GPP_NG_Application_Protocol, NGAP)
>>> SCTP.register(60, NGAP)  # equivalent, PPID given as a plain integer

No PPID is registered by default.

This class currently 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 currently supports parsing of the following chunk parameters, which are directly mapped to the pcapkit.const.sctp.parameter.Parameter enumeration:

This class currently supports parsing of all thirteen error causes 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().

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, **kwargs)[source]

Make (construct) packet data.

Parameters:
Return type:

SCTP

Returns:

Constructed packet data.

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 full qualified class name of the new protocol class should be as {protocol.module}.{protocol.name}.

Parameters:
Return type:

None

Important

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

classmethod register_chunk(code, meth)[source]

Register a chunk parser.

Parameters:
Return type:

None

classmethod register_parameter(code, meth)[source]

Register a chunk parameter parser.

Parameters:
Return type:

None

classmethod register_cause(code, meth)[source]

Register an error cause parser.

Parameters:
Return type:

None

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 self._import_next_layer’s job.

_read_sctp_chunks()[source]

Read SCTP chunk list.

Return type:

OrderedMultiDict[Chunk, Chunk]

Returns:

Extracted SCTP chunks.

_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 schema carries its own trailing PaddingField, computed from the chunk’s own length, so a chunk pads itself to the four-byte boundary required by RFC 9260 Section 3.2.

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

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

Note

The chunk flags are reserved by RFC 9260 Section 3.3.2 and are therefore not exposed on the data model.

_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, *, 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

  • 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, *, 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.

Note

The chunk flags are reserved by RFC 9260 Section 3.3.2 and are always emitted as zero.

_make_chunk_init_ack(code, chunk=None, *, 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.

_make_chunk_sack(code, chunk=None, *, 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

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

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, *, parameters=None, **kwargs)[source]

Make SCTP HEARTBEAT chunk.

Parameters:
Return type:

HeartbeatChunk

Returns:

Constructed chunk schema.

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

Make SCTP HEARTBEAT ACK chunk.

Parameters:
Return type:

HeartbeatACKChunk

Returns:

Constructed chunk schema.

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

Make SCTP ABORT chunk.

Parameters:
Return type:

AbortChunk

Returns:

Constructed chunk schema.

_make_chunk_shutdown(code, chunk=None, *, cum_tsn_ack=0, **kwargs)[source]

Make SCTP SHUTDOWN chunk.

Parameters:
  • code (Chunk) – chunk type

  • chunk (ShutdownChunk | None) – chunk data

  • cum_tsn_ack (int) – cumulative TSN ack

  • **kwargs (Any) – arbitrary keyword arguments

Return type:

ShutdownChunk

Returns:

Constructed chunk schema.

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

Make SCTP SHUTDOWN ACK chunk.

Parameters:
Return type:

ShutdownACKChunk

Returns:

Constructed chunk schema.

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

Make SCTP ERROR chunk.

Parameters:
Return type:

ErrorChunk

Returns:

Constructed chunk schema.

Make SCTP COOKIE ECHO chunk.

Parameters:
  • code (Chunk) – chunk type

  • chunk (CookieEchoChunk | None) – chunk data

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

Make SCTP COOKIE ACK chunk.

Parameters:
Return type:

CookieACKChunk

Returns:

Constructed chunk schema.

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

Make SCTP SHUTDOWN COMPLETE chunk.

Parameters:
  • code (Chunk) – chunk type

  • chunk (ShutdownCompleteChunk | None) – chunk data

  • 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 its null terminator, since the encoding is not specified on the wire.

_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 name is not null-terminated, as required by RFC 9260 Section 3.3.2.1.4.

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

Make SCTP supported address types parameter.

Parameters:
Return type:

SupportedAddressTypesParameter

Returns:

Constructed parameter schema.

_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, **kwargs)[source]

Make SCTP invalid stream identifier error cause.

Parameters:
Return type:

InvalidStreamIdentifierCause

Returns:

Constructed error cause schema.

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

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[Protocol] | Type[Protocol]]

Protocol index mapping for decoding next layer, c.f. 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.

Type:

DefaultDict[int, ModuleDescriptor[Protocol] | Type[Protocol]]

__chunk__: DefaultDict[int, str | tuple[ChunkParser, ChunkConstructor]]

Chunk type to method mapping, c.f. _read_sctp_chunks() and _make_sctp_chunks(). Method names are expected to be referred to the class by _read_chunk_${name} and _make_chunk_${name}, and if such name not found, the value should then be a method that can parse the chunk by itself.

Type:

DefaultDict[Enum_Chunk, str | tuple[ChunkParser, ChunkConstructor]]

__parameter__: DefaultDict[int, str | tuple[ParameterParser, ParameterConstructor]]

DefaultDict[Enum_Parameter, str | tuple[ParameterParser, ParameterConstructor]]: Chunk parameter type to method mapping, c.f. _read_sctp_parameters() and _make_sctp_parameters(). Method names are expected to be referred to the class by _read_param_${name} and _make_param_${name}, and if such name not found, the value should then be a method that can parse the parameter by itself.

__cause__: DefaultDict[int, str | tuple[CauseParser, CauseConstructor]]

Error cause code to method mapping, c.f. _read_sctp_causes() and _make_sctp_causes(). Method names are expected to be referred to the class by _read_cause_${name} and _make_cause_${name}, and if such name not found, the value should then be a method that can parse the error cause by itself.

Type:

DefaultDict[Enum_CauseCode, str | tuple[CauseParser, CauseConstructor]]

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(dict_=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] = <OptionField chunks>

Chunks.

class pcapkit.protocols.schema.transport.sctp.Chunk(dict_=None, **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.

class pcapkit.protocols.schema.transport.sctp.UnknownChunk(dict_=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(dict_=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(dict_=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(dict_=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(dict_=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(dict_=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(dict_=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(dict_=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(dict_=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(dict_=None, **kwargs)[source]

Bases: Chunk

Header schema for SCTP SHUTDOWN ACK chunks.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.ErrorChunk(dict_=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(dict_=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(dict_=None, **kwargs)[source]

Bases: Chunk

Header schema for SCTP COOKIE ACK chunks.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.ShutdownCompleteChunk(dict_=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(dict_=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(dict_=None, **kwargs)[source]

Bases: EnumSchema[Parameter]

Header schema for SCTP chunk parameters.

type: Parameter = <EnumField type>

Parameter type.

length: int = <UInt16Field length>

Parameter length.

class pcapkit.protocols.schema.transport.sctp.UnknownParameter(dict_=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(dict_=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(dict_=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(dict_=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(dict_=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(dict_=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(dict_=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(dict_=None, **kwargs)[source]

Bases: Parameter

Header schema for SCTP host name address parameter.

name: bytes = <BytesField name>

Host name, including at least one null terminator.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.SupportedAddressTypesParameter(dict_=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(dict_=None, **kwargs)[source]

Bases: EnumSchema[CauseCode]

Header schema for SCTP error causes.

code: CauseCode = <EnumField code>

Cause code.

length: int = <UInt16Field length>

Cause length.

class pcapkit.protocols.schema.transport.sctp.UnknownCause(dict_=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(dict_=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 = <PaddingField reserved>

Reserved.

padding: bytes = <PaddingField padding>

Padding.

class pcapkit.protocols.schema.transport.sctp.MissingMandatoryParameterCause(dict_=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(dict_=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(dict_=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(dict_=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(dict_=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(dict_=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(dict_=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(dict_=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(dict_=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(dict_=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(dict_=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(dict_=None, **kwargs)[source]

Bases: ErrorCause

Header schema for SCTP protocol violation error cause.

info: bytes = <BytesField info>

Additional information.

padding: bytes = <PaddingField padding>

Padding.

Type Stubs

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

Bases: TypedDict

SCTP DATA chunk flags.

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.

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, since RFC 9260 Section 3.2 allows the final padding of a packet to be omitted.

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. There are two reasons, and both matter:

  • 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__.

  • 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: the constructors always declare a chunk length that already covers every parameter’s padding, hence a multiple of four, hence no chunk-level padding to emit.

Data Models

class pcapkit.protocols.data.transport.sctp.SCTP(*args: VT, **kwargs: VT)[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: OrderedMultiDict[ChunkType, Chunk]

Chunks.

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

Bases: Data

Data model for SCTP DATA chunk flags.

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(*args: VT, **kwargs: VT)[source]

Bases: Data

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

T: bool

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

class pcapkit.protocols.data.transport.sctp.GapAckBlock(*args: VT, **kwargs: VT)[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(dict_=None, **kwargs)[source]

Bases: Data

Data model for SCTP chunks.

type: ChunkType

Chunk type.

length: int

Chunk length, excluding any trailing padding.

class pcapkit.protocols.data.transport.sctp.UnknownChunk(*args: VT, **kwargs: VT)[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(*args: VT, **kwargs: VT)[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(*args: VT, **kwargs: VT)[source]

Bases: Chunk

Data model for SCTP INIT chunks.

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: OrderedMultiDict[ParameterType, Parameter]

Optional and variable-length parameters.

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

Bases: Chunk

Data model for SCTP INIT ACK chunks.

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: OrderedMultiDict[ParameterType, Parameter]

Optional and variable-length parameters.

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

Bases: Chunk

Data model for SCTP SACK chunks.

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(*args: VT, **kwargs: VT)[source]

Bases: Chunk

Data model for SCTP HEARTBEAT chunks.

parameters: OrderedMultiDict[ParameterType, Parameter]

Heartbeat information parameters.

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

Bases: Chunk

Data model for SCTP HEARTBEAT ACK chunks.

parameters: OrderedMultiDict[ParameterType, Parameter]

Heartbeat information parameters.

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

Bases: Chunk

Data model for SCTP ABORT chunks.

flags: TBitFlags

Chunk flags.

error: OrderedMultiDict[CauseCode, ErrorCause]

Zero or more error causes.

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

Bases: Chunk

Data model for SCTP SHUTDOWN chunks.

cum_tsn_ack: int

Cumulative TSN ack.

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

Bases: Chunk

Data model for SCTP SHUTDOWN ACK chunks.

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

Bases: Chunk

Data model for SCTP ERROR chunks.

error: OrderedMultiDict[CauseCode, ErrorCause]

One or more error causes.

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

Bases: Chunk

Data model for SCTP COOKIE ECHO chunks.

cookie: bytes

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

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

Bases: Chunk

Data model for SCTP COOKIE ACK chunks.

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

Bases: Chunk

Data model for SCTP SHUTDOWN COMPLETE chunks.

flags: TBitFlags

Chunk flags.

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

Bases: Data

Data model for SCTP chunk parameters.

type: ParameterType

Parameter type.

length: int

Parameter length.

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

Bases: Parameter

Data model for SCTP chunk parameters with unknown types.

value: bytes

Parameter value.

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

Bases: Parameter

Data model for SCTP heartbeat info parameter.

info: bytes

Sender-specific heartbeat info.

class pcapkit.protocols.data.transport.sctp.IPv4AddressParameter(*args: VT, **kwargs: VT)[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(*args: VT, **kwargs: VT)[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(*args: VT, **kwargs: VT)[source]

Bases: Parameter

Data model for SCTP state cookie parameter.

cookie: bytes

State cookie.

class pcapkit.protocols.data.transport.sctp.UnrecognizedParameter(*args: VT, **kwargs: VT)[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(*args: VT, **kwargs: VT)[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(*args: VT, **kwargs: VT)[source]

Bases: Parameter

Data model for SCTP host name address parameter.

name: bytes

Host name, including at least one null terminator.

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

Bases: Parameter

Data model for SCTP supported address types parameter.

types: tuple[ParameterType, ...]

Supported address types, given as address parameter types.

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

Bases: Data

Data model for SCTP error causes.

code: CauseCode

Cause code.

length: int

Cause length.

class pcapkit.protocols.data.transport.sctp.UnknownCause(*args: VT, **kwargs: VT)[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(*args: VT, **kwargs: VT)[source]

Bases: ErrorCause

Data model for SCTP invalid stream identifier error cause.

stream_id: int

Stream identifier of the offending DATA chunk.

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

Bases: ErrorCause

Data model for SCTP missing mandatory parameter error cause.

num: int

Number of missing parameters.

types: tuple[ParameterType, ...]

Missing parameter types.

class pcapkit.protocols.data.transport.sctp.StaleCookieCause(*args: VT, **kwargs: VT)[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(*args: VT, **kwargs: VT)[source]

Bases: ErrorCause

Data model for SCTP out of resource error cause.

class pcapkit.protocols.data.transport.sctp.UnresolvableAddressCause(*args: VT, **kwargs: VT)[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(*args: VT, **kwargs: VT)[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(*args: VT, **kwargs: VT)[source]

Bases: ErrorCause

Data model for SCTP invalid mandatory parameter error cause.

class pcapkit.protocols.data.transport.sctp.UnrecognizedParametersCause(*args: VT, **kwargs: VT)[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(*args: VT, **kwargs: VT)[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(*args: VT, **kwargs: VT)[source]

Bases: ErrorCause

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

class pcapkit.protocols.data.transport.sctp.RestartOfAnAssociationWithNewAddressesCause(*args: VT, **kwargs: VT)[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(*args: VT, **kwargs: VT)[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(*args: VT, **kwargs: VT)[source]

Bases: ErrorCause

Data model for SCTP protocol violation error cause.

info: bytes

Additional information.

Footnotes