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 |
|
Source Port |
2 |
16 |
|
Destination Port |
4 |
32 |
|
Verification Tag |
8 |
64 |
|
Checksum (CRC32c) |
12 |
96 |
|
Chunks |
- class pcapkit.protocols.transport.sctp.SCTP(file=None, length=None, **kwargs)[source]¶
-
This class implements Stream Control Transmission Protocol.
Unlike
TCPandUDP, 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). Theself.__proto__registry is therefore keyed by PPID rather than by port number, and is populated throughSCTP.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.Chunkenumeration:Chunk Type
Chunk Parser
Chunk Constructor
Any other chunk type – unassigned, reserved, or defined by an SCTP extension that
pcapkitdoes 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.Parameterenumeration:Parameter Type
Parameter Parser
Parameter Constructor
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.CauseCodeenumeration; seeself.__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 ppid: PayloadProtocolIdentifier | None¶
Payload protocol identifier of the first DATA chunk of the packet.
- Returns:
The PPID used to dispatch the next layer, or
Noneif 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 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- make(srcport=0, dstport=0, vtag=0, chksum=None, chunks=None, **kwargs)[source]¶
Make (construct) packet data.
- Parameters:
vtag (
int) – Verification tag.chksum (
bytes|None) – Checksum. IfNone, the CRC32c checksum of the constructed packet is computed and inserted, per RFC 9260 Section 6.8.chunks (
list[Chunk|tuple[Chunk,dict[str,Any]] |bytes] |OrderedMultiDict[Chunk,Chunk] |None) – SCTP chunks.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed packet data.
Note
There is no
payloadargument: SCTP carries its user data in thedatafield 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:
code (
PayloadProtocolIdentifier|int) – payload protocol identifier (PPID), as inPayloadProtocolIdentifierprotocol (
ModuleDescriptor[ProtocolBase] |Type[ProtocolBase]) – module descriptor or aProtocolsubclass
- Return type:
Important
SCTP overrides
Transport.registerbecause itsself.__proto__registry is keyed by PPID rather than by port number.
- classmethod register_cause(code, meth)[source]¶
Register an error cause parser.
- Parameters:
code (
CauseCode) – SCTP error cause code.meth (
str|tuple[Callable[[ErrorCause,OrderedMultiDict[CauseCode,ErrorCause]],ErrorCause],Callable[[CauseCode,ErrorCause|None,Any],ErrorCause]]) – Method name or callable to parse and/or construct the cause.
- Return type:
- 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.
- 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:
- Returns:
The four bytes to place in the checksum field.
- Raises:
ProtocolError – If
packetis 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:
- Returns:
Whether the checksum field matches the packet contents.
- Raises:
ProtocolError – If
packetis shorter than the 12-byte SCTP common header.
- _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 emptybytesis returned and the next layer resolves toNoPayload.
- _decode_next_layer(dict_, proto=None, length=None, *, packet=None)[source]¶
Decode next layer protocol.
- Parameters:
- Return type:
- 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_layerdoes for an unregistered transport type. Resolving it toRawisself._import_next_layer’s job.
- _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:
- Returns:
Constructed chunk schemas.
Note
No alignment fix-up happens here, unlike
TCP._make_tcp_options: every chunk schema carries its own trailingPaddingField, computed from the chunk’s ownlength, 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.
- _read_sctp_parameters(schemas)[source]¶
Read SCTP chunk parameter list.
- Parameters:
- Return type:
- Returns:
Extracted SCTP chunk parameters.
- _make_sctp_parameter(code, parameter=None, **kwargs)[source]¶
Dispatch to the parameter constructor registered for
code.
- _read_sctp_causes(schemas)[source]¶
Read SCTP error cause list.
- Parameters:
schemas (
list[ErrorCause]) – Parsed error cause schemas.- Return type:
- 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:
- 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
pcapkitdoes 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:
schema (
UnknownChunk) – parsed chunk schemachunks (
OrderedMultiDict[Chunk,Chunk]) – extracted SCTP chunks
- Return type:
- 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:
schema (
DATAChunk) – parsed chunk schemachunks (
OrderedMultiDict[Chunk,Chunk]) – extracted SCTP chunks
- Return type:
- Returns:
Parsed chunk data.
- Raises:
ProtocolError – If
lengthis NOT greater than16, 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:
schema (
INITChunk) – parsed chunk schemachunks (
OrderedMultiDict[Chunk,Chunk]) – extracted SCTP chunks
- Return type:
- Returns:
Parsed chunk data.
- Raises:
ProtocolError – If
lengthis NOT at least20.
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:
schema (
INITACKChunk) – parsed chunk schemachunks (
OrderedMultiDict[Chunk,Chunk]) – extracted SCTP chunks
- Return type:
- Returns:
Parsed chunk data.
- Raises:
ProtocolError – If
lengthis NOT at least20.
- _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:
schema (
SACKChunk) – parsed chunk schemachunks (
OrderedMultiDict[Chunk,Chunk]) – extracted SCTP chunks
- Return type:
- Returns:
Parsed chunk data.
- Raises:
ProtocolError – If
lengthdoes 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:
schema (
HeartbeatChunk) – parsed chunk schemachunks (
OrderedMultiDict[Chunk,Chunk]) – extracted SCTP chunks
- Return type:
- Returns:
Parsed chunk data.
- Raises:
ProtocolError – If
lengthis NOT at least4.
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:
schema (
HeartbeatACKChunk) – parsed chunk schemachunks (
OrderedMultiDict[Chunk,Chunk]) – extracted SCTP chunks
- Return type:
- Returns:
Parsed chunk data.
- Raises:
ProtocolError – If
lengthis NOT at least4.
- _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:
schema (
AbortChunk) – parsed chunk schemachunks (
OrderedMultiDict[Chunk,Chunk]) – extracted SCTP chunks
- Return type:
- Returns:
Parsed chunk data.
- Raises:
ProtocolError – If
lengthis NOT at least4.
- _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:
schema (
ShutdownChunk) – parsed chunk schemachunks (
OrderedMultiDict[Chunk,Chunk]) – extracted SCTP chunks
- Return type:
- Returns:
Parsed chunk data.
- Raises:
ProtocolError – If
lengthis NOT8.
- _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:
schema (
ShutdownACKChunk) – parsed chunk schemachunks (
OrderedMultiDict[Chunk,Chunk]) – extracted SCTP chunks
- Return type:
- Returns:
Parsed chunk data.
- Raises:
ProtocolError – If
lengthis NOT4.
- _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:
schema (
ErrorChunk) – parsed chunk schemachunks (
OrderedMultiDict[Chunk,Chunk]) – extracted SCTP chunks
- Return type:
- Returns:
Parsed chunk data.
- Raises:
ProtocolError – If
lengthis NOT at least4.
- _read_chunk_cookie_echo(schema, *, chunks)[source]¶
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:
schema (
CookieEchoChunk) – parsed chunk schemachunks (
OrderedMultiDict[Chunk,Chunk]) – extracted SCTP chunks
- Return type:
- Returns:
Parsed chunk data.
- Raises:
ProtocolError – If
lengthis NOT at least4.
Note
A COOKIE ECHO chunk carries the contents of the state cookie parameter rather than the parameter itself, so the cookie is a plain
byteshere rather than aStateCookieParameter.
- _read_chunk_cookie_ack(schema, *, chunks)[source]¶
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:
schema (
CookieACKChunk) – parsed chunk schemachunks (
OrderedMultiDict[Chunk,Chunk]) – extracted SCTP chunks
- Return type:
- Returns:
Parsed chunk data.
- Raises:
ProtocolError – If
lengthis NOT4.
- _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:
schema (
ShutdownCompleteChunk) – parsed chunk schemachunks (
OrderedMultiDict[Chunk,Chunk]) – extracted SCTP chunks
- Return type:
- Returns:
Parsed chunk data.
- Raises:
ProtocolError – If
lengthis NOT4.
- _make_chunk_donone(code, chunk=None, *, flags=b'\\x00', value=b'', **kwargs)[source]¶
Make SCTP chunk of an unsupported type.
- Parameters:
- Return type:
- Returns:
Constructed chunk schema.
- Raises:
ProtocolError – If
flagsis 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 typeI (
bool) – immediate bitU (
bool) – unordered bitB (
bool) – beginning fragment bitE (
bool) – ending fragment bittsn (
int) – transmission sequence numberstream_id (
int) – stream identifierstream_seq (
int) – stream sequence numberppid (
PayloadProtocolIdentifier|int) – payload protocol identifierdata (
bytes) – user data**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed chunk schema.
- Raises:
ProtocolError – If
datais 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:
code (
Chunk) – chunk typeinit_tag (
int) – initiate taga_rwnd (
int) – advertised receiver window creditoutbound_streams (
int) – number of outbound streamsinbound_streams (
int) – number of inbound streamsinit_tsn (
int) – initial transmission sequence numberparameters (
list[Parameter|tuple[Parameter,dict[str,Any]] |bytes] |OrderedMultiDict[Parameter,Parameter] |None) – optional and variable-length parameters**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- 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:
code (
Chunk) – chunk typechunk (
INITACKChunk|None) – chunk datainit_tag (
int) – initiate taga_rwnd (
int) – advertised receiver window creditoutbound_streams (
int) – number of outbound streamsinbound_streams (
int) – number of inbound streamsinit_tsn (
int) – initial transmission sequence numberparameters (
list[Parameter|tuple[Parameter,dict[str,Any]] |bytes] |OrderedMultiDict[Parameter,Parameter] |None) – optional and variable-length parameters**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- 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 typecum_tsn_ack (
int) – cumulative TSN acka_rwnd (
int) – advertised receiver window creditgap_blocks (
list[GapAckBlock|GapAckBlock|tuple[int,int]] |None) – gap ack blocks, each as a schema, a data model or a(start, end)pair**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- 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:
- Returns:
Constructed chunk schema.
- _make_chunk_heartbeat_ack(code, chunk=None, *, parameters=None, **kwargs)[source]¶
Make SCTP HEARTBEAT ACK chunk.
- Parameters:
- Return type:
- Returns:
Constructed chunk schema.
- _make_chunk_abort(code, chunk=None, *, T=False, error=None, **kwargs)[source]¶
Make SCTP ABORT chunk.
- Parameters:
code (
Chunk) – chunk typechunk (
AbortChunk|None) – chunk dataT (
bool) – whether the verification tag has been reflectederror (
list[ErrorCause|tuple[CauseCode,dict[str,Any]] |bytes] |OrderedMultiDict[CauseCode,ErrorCause] |None) – zero or more error causes**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed chunk schema.
- _make_chunk_shutdown(code, chunk=None, *, cum_tsn_ack=0, **kwargs)[source]¶
Make SCTP SHUTDOWN chunk.
- Parameters:
code (
Chunk) – chunk typechunk (
ShutdownChunk|None) – chunk datacum_tsn_ack (
int) – cumulative TSN ack**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed chunk schema.
- _make_chunk_shutdown_ack(code, chunk=None, **kwargs)[source]¶
Make SCTP SHUTDOWN ACK chunk.
- Parameters:
code (
Chunk) – chunk typechunk (
ShutdownACKChunk|None) – chunk data**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed chunk schema.
- _make_chunk_error(code, chunk=None, *, error=None, **kwargs)[source]¶
Make SCTP ERROR chunk.
- Parameters:
code (
Chunk) – chunk typechunk (
ErrorChunk|None) – chunk dataerror (
list[ErrorCause|tuple[CauseCode,dict[str,Any]] |bytes] |OrderedMultiDict[CauseCode,ErrorCause] |None) – one or more error causes**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed chunk schema.
- _make_chunk_cookie_echo(code, chunk=None, *, cookie=b'', **kwargs)[source]¶
Make SCTP COOKIE ECHO chunk.
- Parameters:
code (
Chunk) – chunk typechunk (
CookieEchoChunk|None) – chunk datacookie (
bytes) – state cookie, as received in the INIT ACK chunk’s state cookie parameter**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed chunk schema.
- _make_chunk_cookie_ack(code, chunk=None, **kwargs)[source]¶
Make SCTP COOKIE ACK chunk.
- Parameters:
code (
Chunk) – chunk typechunk (
CookieACKChunk|None) – chunk data**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed chunk schema.
- _make_chunk_shutdown_complete(code, chunk=None, *, T=False, **kwargs)[source]¶
Make SCTP SHUTDOWN COMPLETE chunk.
- Parameters:
code (
Chunk) – chunk typechunk (
ShutdownCompleteChunk|None) – chunk dataT (
bool) – whether the verification tag has been reflected**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- 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
pcapkitdoes not implement. The parameter’s value is recorded verbatim rather than raising, so a chunk carrying an unknown parameter still parses.- Parameters:
schema (
UnknownParameter) – parsed parameter schemaparameters (
OrderedMultiDict[Parameter,Parameter]) – extracted SCTP chunk parameters
- Return type:
- 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:
schema (
HeartbeatInfoParameter) – parsed parameter schemaparameters (
OrderedMultiDict[Parameter,Parameter]) – extracted SCTP chunk parameters
- Return type:
- Returns:
Parsed parameter data.
- Raises:
ProtocolError – If
lengthis NOT at least4.
- _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:
schema (
IPv4AddressParameter) – parsed parameter schemaparameters (
OrderedMultiDict[Parameter,Parameter]) – extracted SCTP chunk parameters
- Return type:
- Returns:
Parsed parameter data.
- Raises:
ProtocolError – If
lengthis NOT8.
- _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:
schema (
IPv6AddressParameter) – parsed parameter schemaparameters (
OrderedMultiDict[Parameter,Parameter]) – extracted SCTP chunk parameters
- Return type:
- Returns:
Parsed parameter data.
- Raises:
ProtocolError – If
lengthis NOT20.
- _read_param_cookie(schema, *, parameters)[source]¶
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:
schema (
StateCookieParameter) – parsed parameter schemaparameters (
OrderedMultiDict[Parameter,Parameter]) – extracted SCTP chunk parameters
- Return type:
- Returns:
Parsed parameter data.
- Raises:
ProtocolError – If
lengthis NOT at least4.
- _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:
schema (
UnrecognizedParameter) – parsed parameter schemaparameters (
OrderedMultiDict[Parameter,Parameter]) – extracted SCTP chunk parameters
- Return type:
- Returns:
Parsed parameter data.
- Raises:
ProtocolError – If
lengthis NOT at least4.
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:
schema (
CookiePreservativeParameter) – parsed parameter schemaparameters (
OrderedMultiDict[Parameter,Parameter]) – extracted SCTP chunk parameters
- Return type:
- Returns:
Parsed parameter data.
- Raises:
ProtocolError – If
lengthis NOT8.
- _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:
schema (
HostNameAddressParameter) – parsed parameter schemaparameters (
OrderedMultiDict[Parameter,Parameter]) – extracted SCTP chunk parameters
- Return type:
- Returns:
Parsed parameter data.
- Raises:
ProtocolError – If
lengthis NOT at least4.
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:
schema (
SupportedAddressTypesParameter) – parsed parameter schemaparameters (
OrderedMultiDict[Parameter,Parameter]) – extracted SCTP chunk parameters
- Return type:
- Returns:
Parsed parameter data.
- Raises:
ProtocolError – If
lengthis NOT4plus a multiple of2.
- _make_param_donone(code, param=None, *, value=b'', **kwargs)[source]¶
Make SCTP chunk parameter of an unsupported type.
- Parameters:
- Return type:
- Returns:
Constructed parameter schema.
- _make_param_hbinfo(code, param=None, *, info=b'', **kwargs)[source]¶
Make SCTP heartbeat info parameter.
- Parameters:
code (
Parameter) – parameter typeparam (
HeartbeatInfoParameter|None) – parameter datainfo (
bytes) – sender-specific heartbeat info**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed parameter schema.
- _make_param_ipv4(code, param=None, *, address='0.0.0.0', **kwargs)[source]¶
Make SCTP IPv4 address parameter.
- Parameters:
code (
Parameter) – parameter typeparam (
IPv4AddressParameter|None) – parameter dataaddress (
IPv4Address|int|str|bytes) – IPv4 address of the sending endpoint**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed parameter schema.
- _make_param_ipv6(code, param=None, *, address='::', **kwargs)[source]¶
Make SCTP IPv6 address parameter.
- Parameters:
code (
Parameter) – parameter typeparam (
IPv6AddressParameter|None) – parameter dataaddress (
IPv6Address|int|str|bytes) – IPv6 address of the sending endpoint**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed parameter schema.
- _make_param_cookie(code, param=None, *, cookie=b'', **kwargs)[source]¶
Make SCTP state cookie parameter.
- Parameters:
code (
Parameter) – parameter typeparam (
StateCookieParameter|None) – parameter datacookie (
bytes) – state cookie**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed parameter schema.
- _make_param_unrecognized(code, param=None, *, value=b'', **kwargs)[source]¶
Make SCTP unrecognized parameter parameter.
- Parameters:
code (
Parameter) – parameter typeparam (
UnrecognizedParameter|None) – parameter datavalue (
bytes) – the unrecognized parameter, complete with its type and length**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed parameter schema.
- _make_param_preservative(code, param=None, *, increment=0, **kwargs)[source]¶
Make SCTP cookie preservative parameter.
- Parameters:
code (
Parameter) – parameter typeparam (
CookiePreservativeParameter|None) – parameter dataincrement (
int) – suggested cookie life-span increment, in milliseconds**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed parameter schema.
- _make_param_hostname(code, param=None, *, name=b'\\x00', **kwargs)[source]¶
Make SCTP host name address parameter.
- Parameters:
code (
Parameter) – parameter typeparam (
HostNameAddressParameter|None) – parameter dataname (
bytes) – host name, including at least one null terminator**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed parameter schema.
- Raises:
ProtocolError – If
nameis 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:
- 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
pcapkitdoes not implement, e.g. those registered by SCTP extensions. The cause-specific information is recorded verbatim rather than raising.- Parameters:
schema (
UnknownCause) – parsed error cause schemacauses (
OrderedMultiDict[CauseCode,ErrorCause]) – extracted SCTP error causes
- Return type:
- 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:
schema (
InvalidStreamIdentifierCause) – parsed error cause schemacauses (
OrderedMultiDict[CauseCode,ErrorCause]) – extracted SCTP error causes
- Return type:
- Returns:
Parsed error cause data.
- Raises:
ProtocolError – If
lengthis NOT8.
- _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:
schema (
MissingMandatoryParameterCause) – parsed error cause schemacauses (
OrderedMultiDict[CauseCode,ErrorCause]) – extracted SCTP error causes
- Return type:
- Returns:
Parsed error cause data.
- Raises:
ProtocolError – If
lengthdoes NOT match the declared number of missing parameters.
- _read_cause_stale_cookie(schema, *, causes)[source]¶
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:
schema (
StaleCookieCause) – parsed error cause schemacauses (
OrderedMultiDict[CauseCode,ErrorCause]) – extracted SCTP error causes
- Return type:
- Returns:
Parsed error cause data.
- Raises:
ProtocolError – If
lengthis NOT8.
- _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:
schema (
OutOfResourceCause) – parsed error cause schemacauses (
OrderedMultiDict[CauseCode,ErrorCause]) – extracted SCTP error causes
- Return type:
- Returns:
Parsed error cause data.
- Raises:
ProtocolError – If
lengthis NOT4.
- _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:
schema (
UnresolvableAddressCause) – parsed error cause schemacauses (
OrderedMultiDict[CauseCode,ErrorCause]) – extracted SCTP error causes
- Return type:
- Returns:
Parsed error cause data.
- Raises:
ProtocolError – If
lengthis NOT at least4.
- _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:
schema (
UnrecognizedChunkTypeCause) – parsed error cause schemacauses (
OrderedMultiDict[CauseCode,ErrorCause]) – extracted SCTP error causes
- Return type:
- Returns:
Parsed error cause data.
- Raises:
ProtocolError – If
lengthis NOT at least4.
- _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:
schema (
InvalidMandatoryParameterCause) – parsed error cause schemacauses (
OrderedMultiDict[CauseCode,ErrorCause]) – extracted SCTP error causes
- Return type:
- Returns:
Parsed error cause data.
- Raises:
ProtocolError – If
lengthis NOT4.
- _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:
schema (
UnrecognizedParametersCause) – parsed error cause schemacauses (
OrderedMultiDict[CauseCode,ErrorCause]) – extracted SCTP error causes
- Return type:
- Returns:
Parsed error cause data.
- Raises:
ProtocolError – If
lengthis NOT at least4.
- _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:
schema (
NoUserDataCause) – parsed error cause schemacauses (
OrderedMultiDict[CauseCode,ErrorCause]) – extracted SCTP error causes
- Return type:
- Returns:
Parsed error cause data.
- Raises:
ProtocolError – If
lengthis NOT8.
- _read_cause_cookie_shutdown(schema, *, causes)[source]¶
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:
schema (
CookieReceivedWhileShuttingDownCause) – parsed error cause schemacauses (
OrderedMultiDict[CauseCode,ErrorCause]) – extracted SCTP error causes
- Return type:
- Returns:
Parsed error cause data.
- Raises:
ProtocolError – If
lengthis NOT4.
- _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:
schema (
RestartOfAnAssociationWithNewAddressesCause) – parsed error cause schemacauses (
OrderedMultiDict[CauseCode,ErrorCause]) – extracted SCTP error causes
- Return type:
- Returns:
Parsed error cause data.
- Raises:
ProtocolError – If
lengthis NOT at least4.
- _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:
schema (
UserInitiatedAbortCause) – parsed error cause schemacauses (
OrderedMultiDict[CauseCode,ErrorCause]) – extracted SCTP error causes
- Return type:
- Returns:
Parsed error cause data.
- Raises:
ProtocolError – If
lengthis NOT at least4.
- _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:
schema (
ProtocolViolationCause) – parsed error cause schemacauses (
OrderedMultiDict[CauseCode,ErrorCause]) – extracted SCTP error causes
- Return type:
- Returns:
Parsed error cause data.
- Raises:
ProtocolError – If
lengthis NOT at least4.
- _make_cause_donone(code, cause=None, *, value=b'', **kwargs)[source]¶
Make SCTP error cause of an unsupported cause code.
- Parameters:
- Return type:
- 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:
code (
CauseCode) – error cause codecause (
InvalidStreamIdentifierCause|None) – error cause datastream_id (
int) – stream identifier of the offending DATA chunk**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- 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:
- Returns:
Constructed error cause schema.
Note
The count of missing parameters is derived from
typesrather than taken as an argument, so that it cannot disagree with the list it counts.
- _make_cause_stale_cookie(code, cause=None, *, staleness=0, **kwargs)[source]¶
Make SCTP stale cookie error cause.
- Parameters:
code (
CauseCode) – error cause codecause (
StaleCookieCause|None) – error cause datastaleness (
int) – measure of staleness, in microseconds**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed error cause schema.
- _make_cause_out_of_resource(code, cause=None, **kwargs)[source]¶
Make SCTP out of resource error cause.
- Parameters:
code (
CauseCode) – error cause codecause (
OutOfResourceCause|None) – error cause data**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- 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 codecause (
UnresolvableAddressCause|None) – error cause datavalue (
bytes) – the offending address parameter, complete with its type and length**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed error cause schema.
- _make_cause_unrecognized_chunk(code, cause=None, *, value=b'', **kwargs)[source]¶
Make SCTP unrecognized chunk type error cause.
- Parameters:
code (
CauseCode) – error cause codecause (
UnrecognizedChunkTypeCause|None) – error cause datavalue (
bytes) – the unrecognized chunk, complete with its type, flags and length**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed error cause schema.
- _make_cause_invalid_param(code, cause=None, **kwargs)[source]¶
Make SCTP invalid mandatory parameter error cause.
- Parameters:
code (
CauseCode) – error cause codecause (
InvalidMandatoryParameterCause|None) – error cause data**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed error cause schema.
- _make_cause_unrecognized_params(code, cause=None, *, value=b'', **kwargs)[source]¶
Make SCTP unrecognized parameters error cause.
- Parameters:
code (
CauseCode) – error cause codecause (
UnrecognizedParametersCause|None) – error cause datavalue (
bytes) – the unrecognized parameters, complete with their types and lengths**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- 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 codecause (
NoUserDataCause|None) – error cause datatsn (
int) – TSN of the offending DATA chunk**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed error cause schema.
- _make_cause_cookie_shutdown(code, cause=None, **kwargs)[source]¶
Make SCTP cookie received while shutting down error cause.
- Parameters:
code (
CauseCode) – error cause codecause (
CookieReceivedWhileShuttingDownCause|None) – error cause data**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- 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:
code (
CauseCode) – error cause codecause (
RestartOfAnAssociationWithNewAddressesCause|None) – error cause datavalue (
bytes) – the new address parameters, complete with their types and lengths**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed error cause schema.
- _make_cause_user_abort(code, cause=None, *, info=b'', **kwargs)[source]¶
Make SCTP user-initiated abort error cause.
- Parameters:
code (
CauseCode) – error cause codecause (
UserInitiatedAbortCause|None) – error cause datainfo (
bytes) – upper layer abort reason**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed error cause schema.
- _make_cause_protocol_violation(code, cause=None, *, info=b'', **kwargs)[source]¶
Make SCTP protocol violation error cause.
- Parameters:
code (
CauseCode) – error cause codecause (
ProtocolViolationCause|None) – error cause datainfo (
bytes) – additional information**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- 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
TCPandUDP.- 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.
- __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.
Header Schemas¶
- class pcapkit.protocols.schema.transport.sctp.SCTP(dict_=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for SCTP packets.
Note
Unlike
TCPandUDP, there is no payload field, since SCTP carries its user data inside DATA chunks rather than after the common header. SeeSCTP._get_payloadfor how the next layer is located.
- class pcapkit.protocols.schema.transport.sctp.Chunk(dict_=None, **kwargs)[source]¶
Bases:
EnumSchema[Chunk]Header schema for SCTP chunks.
- class pcapkit.protocols.schema.transport.sctp.UnknownChunk(dict_=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP chunks with unknown types.
- class pcapkit.protocols.schema.transport.sctp.DATAChunk(dict_=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP DATA chunks.
- flags: DATAChunkFlags = <BitField flags>¶
Chunk flags.
- ppid: PayloadProtocolIdentifier = <EnumField ppid>¶
Payload protocol identifier.
- class pcapkit.protocols.schema.transport.sctp.INITChunk(dict_=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP INIT chunks.
- 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:
ChunkHeader schema for SCTP INIT ACK chunks.
- 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:
ChunkHeader schema for SCTP SACK chunks.
- gap_blocks: list[GapAckBlock] = <ListField gap_blocks>¶
Gap ack blocks.
- class pcapkit.protocols.schema.transport.sctp.HeartbeatChunk(dict_=None, **kwargs)[source]¶
Bases:
ChunkHeader 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:
ChunkHeader 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:
ChunkHeader schema for SCTP ABORT chunks.
- 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:
ChunkHeader schema for SCTP SHUTDOWN chunks.
- class pcapkit.protocols.schema.transport.sctp.ShutdownACKChunk(dict_=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP SHUTDOWN ACK chunks.
- class pcapkit.protocols.schema.transport.sctp.ErrorChunk(dict_=None, **kwargs)[source]¶
Bases:
ChunkHeader 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:
ChunkHeader schema for SCTP COOKIE ECHO chunks.
- class pcapkit.protocols.schema.transport.sctp.CookieACKChunk(dict_=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP COOKIE ACK chunks.
- class pcapkit.protocols.schema.transport.sctp.ShutdownCompleteChunk(dict_=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP SHUTDOWN COMPLETE chunks.
- class pcapkit.protocols.schema.transport.sctp.GapAckBlock(dict_=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for SCTP SACK chunk gap ack blocks.
- class pcapkit.protocols.schema.transport.sctp.Parameter(dict_=None, **kwargs)[source]¶
Bases:
EnumSchema[Parameter]Header schema for SCTP chunk parameters.
- class pcapkit.protocols.schema.transport.sctp.UnknownParameter(dict_=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP chunk parameters with unknown types.
- class pcapkit.protocols.schema.transport.sctp.HeartbeatInfoParameter(dict_=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP heartbeat info parameter.
- class pcapkit.protocols.schema.transport.sctp.IPv4AddressParameter(dict_=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP IPv4 address parameter.
- address: IPv4Address = <IPv4AddressField address>¶
IPv4 address of the sending endpoint.
- class pcapkit.protocols.schema.transport.sctp.IPv6AddressParameter(dict_=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP IPv6 address parameter.
- address: IPv6Address = <IPv6AddressField address>¶
IPv6 address of the sending endpoint.
- class pcapkit.protocols.schema.transport.sctp.StateCookieParameter(dict_=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP state cookie parameter.
- class pcapkit.protocols.schema.transport.sctp.UnrecognizedParameter(dict_=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP unrecognized parameter parameter.
- class pcapkit.protocols.schema.transport.sctp.CookiePreservativeParameter(dict_=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP cookie preservative parameter.
- class pcapkit.protocols.schema.transport.sctp.HostNameAddressParameter(dict_=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP host name address parameter.
- class pcapkit.protocols.schema.transport.sctp.SupportedAddressTypesParameter(dict_=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP supported address types parameter.
- class pcapkit.protocols.schema.transport.sctp.ErrorCause(dict_=None, **kwargs)[source]¶
Bases:
EnumSchema[CauseCode]Header schema for SCTP error causes.
- class pcapkit.protocols.schema.transport.sctp.UnknownCause(dict_=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP error causes with unknown cause codes.
- class pcapkit.protocols.schema.transport.sctp.InvalidStreamIdentifierCause(dict_=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP invalid stream identifier error cause.
- class pcapkit.protocols.schema.transport.sctp.MissingMandatoryParameterCause(dict_=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP missing mandatory parameter error cause.
- class pcapkit.protocols.schema.transport.sctp.StaleCookieCause(dict_=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP stale cookie error cause.
- class pcapkit.protocols.schema.transport.sctp.OutOfResourceCause(dict_=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP out of resource error cause.
- class pcapkit.protocols.schema.transport.sctp.UnresolvableAddressCause(dict_=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP unresolvable address error cause.
- class pcapkit.protocols.schema.transport.sctp.UnrecognizedChunkTypeCause(dict_=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP unrecognized chunk type error cause.
- class pcapkit.protocols.schema.transport.sctp.InvalidMandatoryParameterCause(dict_=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP invalid mandatory parameter error cause.
- class pcapkit.protocols.schema.transport.sctp.UnrecognizedParametersCause(dict_=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP unrecognized parameters error cause.
- class pcapkit.protocols.schema.transport.sctp.NoUserDataCause(dict_=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP no user data error cause.
- class pcapkit.protocols.schema.transport.sctp.CookieReceivedWhileShuttingDownCause(dict_=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP cookie received while shutting down error cause.
- class pcapkit.protocols.schema.transport.sctp.RestartOfAnAssociationWithNewAddressesCause(dict_=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP restart of an association with new addresses error cause.
- class pcapkit.protocols.schema.transport.sctp.UserInitiatedAbortCause(dict_=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP user-initiated abort error cause.
- class pcapkit.protocols.schema.transport.sctp.ProtocolViolationCause(dict_=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP protocol violation error cause.
Type Stubs¶
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
lengthfield. The padding is still on the wire, though, so it has to be consumed for the enclosing list to stay aligned.- Parameters:
- Return type:
- 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:
- 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.packpasses one sharedpacketmapping down into the nested schemas, and each nested parameter overwritespacket['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:
ProtocolData model for SCTP packet.
- chunks: OrderedMultiDict[ChunkType, Chunk]¶
Chunks.
- class pcapkit.protocols.data.transport.sctp.DATAChunkFlags(*args: VT, **kwargs: VT)[source]¶
Bases:
DataData model for SCTP DATA chunk flags.
- class pcapkit.protocols.data.transport.sctp.TBitFlags(*args: VT, **kwargs: VT)[source]¶
Bases:
DataData model for SCTP chunk flags carrying only the T bit, i.e., ABORT and SHUTDOWN COMPLETE chunks.
- class pcapkit.protocols.data.transport.sctp.GapAckBlock(*args: VT, **kwargs: VT)[source]¶
Bases:
DataData model for SCTP SACK chunk gap ack blocks.
- class pcapkit.protocols.data.transport.sctp.Chunk(dict_=None, **kwargs)[source]¶
Bases:
DataData model for SCTP chunks.
- type: ChunkType¶
Chunk type.
- class pcapkit.protocols.data.transport.sctp.UnknownChunk(*args: VT, **kwargs: VT)[source]¶
Bases:
ChunkData model for SCTP chunks with unknown types.
- class pcapkit.protocols.data.transport.sctp.DATAChunk(*args: VT, **kwargs: VT)[source]¶
Bases:
ChunkData model for SCTP DATA chunks.
- flags: DATAChunkFlags¶
Chunk flags.
- ppid: PayloadProtocolIdentifier¶
Payload protocol identifier.
- class pcapkit.protocols.data.transport.sctp.INITChunk(*args: VT, **kwargs: VT)[source]¶
Bases:
ChunkData model for SCTP INIT chunks.
- parameters: OrderedMultiDict[ParameterType, Parameter]¶
Optional and variable-length parameters.
- class pcapkit.protocols.data.transport.sctp.INITACKChunk(*args: VT, **kwargs: VT)[source]¶
Bases:
ChunkData model for SCTP INIT ACK chunks.
- parameters: OrderedMultiDict[ParameterType, Parameter]¶
Optional and variable-length parameters.
- class pcapkit.protocols.data.transport.sctp.SACKChunk(*args: VT, **kwargs: VT)[source]¶
Bases:
ChunkData model for SCTP SACK chunks.
- gap_blocks: tuple[GapAckBlock, ...]¶
Gap ack blocks.
- class pcapkit.protocols.data.transport.sctp.HeartbeatChunk(*args: VT, **kwargs: VT)[source]¶
Bases:
ChunkData 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:
ChunkData 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:
ChunkData model for SCTP ABORT chunks.
- error: OrderedMultiDict[CauseCode, ErrorCause]¶
Zero or more error causes.
- class pcapkit.protocols.data.transport.sctp.ShutdownChunk(*args: VT, **kwargs: VT)[source]¶
Bases:
ChunkData model for SCTP SHUTDOWN chunks.
- class pcapkit.protocols.data.transport.sctp.ShutdownACKChunk(*args: VT, **kwargs: VT)[source]¶
Bases:
ChunkData model for SCTP SHUTDOWN ACK chunks.
- class pcapkit.protocols.data.transport.sctp.ErrorChunk(*args: VT, **kwargs: VT)[source]¶
Bases:
ChunkData 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:
ChunkData model for SCTP COOKIE ECHO chunks.
- class pcapkit.protocols.data.transport.sctp.CookieACKChunk(*args: VT, **kwargs: VT)[source]¶
Bases:
ChunkData model for SCTP COOKIE ACK chunks.
- class pcapkit.protocols.data.transport.sctp.ShutdownCompleteChunk(*args: VT, **kwargs: VT)[source]¶
Bases:
ChunkData model for SCTP SHUTDOWN COMPLETE chunks.
- class pcapkit.protocols.data.transport.sctp.Parameter(dict_=None, **kwargs)[source]¶
Bases:
DataData model for SCTP chunk parameters.
- type: ParameterType¶
Parameter type.
- class pcapkit.protocols.data.transport.sctp.UnknownParameter(*args: VT, **kwargs: VT)[source]¶
Bases:
ParameterData model for SCTP chunk parameters with unknown types.
- class pcapkit.protocols.data.transport.sctp.HeartbeatInfoParameter(*args: VT, **kwargs: VT)[source]¶
Bases:
ParameterData model for SCTP heartbeat info parameter.
- class pcapkit.protocols.data.transport.sctp.IPv4AddressParameter(*args: VT, **kwargs: VT)[source]¶
Bases:
ParameterData 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:
ParameterData 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:
ParameterData model for SCTP state cookie parameter.
- class pcapkit.protocols.data.transport.sctp.UnrecognizedParameter(*args: VT, **kwargs: VT)[source]¶
Bases:
ParameterData model for SCTP unrecognized parameter parameter.
- class pcapkit.protocols.data.transport.sctp.CookiePreservativeParameter(*args: VT, **kwargs: VT)[source]¶
Bases:
ParameterData model for SCTP cookie preservative parameter.
- class pcapkit.protocols.data.transport.sctp.HostNameAddressParameter(*args: VT, **kwargs: VT)[source]¶
Bases:
ParameterData model for SCTP host name address parameter.
- class pcapkit.protocols.data.transport.sctp.SupportedAddressTypesParameter(*args: VT, **kwargs: VT)[source]¶
Bases:
ParameterData model for SCTP supported address types parameter.
- class pcapkit.protocols.data.transport.sctp.ErrorCause(dict_=None, **kwargs)[source]¶
Bases:
DataData model for SCTP error causes.
- class pcapkit.protocols.data.transport.sctp.UnknownCause(*args: VT, **kwargs: VT)[source]¶
Bases:
ErrorCauseData model for SCTP error causes with unknown cause codes.
- class pcapkit.protocols.data.transport.sctp.InvalidStreamIdentifierCause(*args: VT, **kwargs: VT)[source]¶
Bases:
ErrorCauseData model for SCTP invalid stream identifier error cause.
- class pcapkit.protocols.data.transport.sctp.MissingMandatoryParameterCause(*args: VT, **kwargs: VT)[source]¶
Bases:
ErrorCauseData model for SCTP missing mandatory parameter error cause.
- class pcapkit.protocols.data.transport.sctp.StaleCookieCause(*args: VT, **kwargs: VT)[source]¶
Bases:
ErrorCauseData model for SCTP stale cookie error cause.
- class pcapkit.protocols.data.transport.sctp.OutOfResourceCause(*args: VT, **kwargs: VT)[source]¶
Bases:
ErrorCauseData model for SCTP out of resource error cause.
- class pcapkit.protocols.data.transport.sctp.UnresolvableAddressCause(*args: VT, **kwargs: VT)[source]¶
Bases:
ErrorCauseData model for SCTP unresolvable address error cause.
- class pcapkit.protocols.data.transport.sctp.UnrecognizedChunkTypeCause(*args: VT, **kwargs: VT)[source]¶
Bases:
ErrorCauseData model for SCTP unrecognized chunk type error cause.
- class pcapkit.protocols.data.transport.sctp.InvalidMandatoryParameterCause(*args: VT, **kwargs: VT)[source]¶
Bases:
ErrorCauseData model for SCTP invalid mandatory parameter error cause.
- class pcapkit.protocols.data.transport.sctp.UnrecognizedParametersCause(*args: VT, **kwargs: VT)[source]¶
Bases:
ErrorCauseData model for SCTP unrecognized parameters error cause.
- class pcapkit.protocols.data.transport.sctp.NoUserDataCause(*args: VT, **kwargs: VT)[source]¶
Bases:
ErrorCauseData model for SCTP no user data error cause.
- class pcapkit.protocols.data.transport.sctp.CookieReceivedWhileShuttingDownCause(*args: VT, **kwargs: VT)[source]¶
Bases:
ErrorCauseData model for SCTP cookie received while shutting down error cause.
- class pcapkit.protocols.data.transport.sctp.RestartOfAnAssociationWithNewAddressesCause(*args: VT, **kwargs: VT)[source]¶
Bases:
ErrorCauseData model for SCTP restart of an association with new addresses error cause.
- class pcapkit.protocols.data.transport.sctp.UserInitiatedAbortCause(*args: VT, **kwargs: VT)[source]¶
Bases:
ErrorCauseData model for SCTP user-initiated abort error cause.
- class pcapkit.protocols.data.transport.sctp.ProtocolViolationCause(*args: VT, **kwargs: VT)[source]¶
Bases:
ErrorCauseData model for SCTP protocol violation error cause.
Footnotes