SCTP - Stream Control Transmission Protocol¶
Removed in version 1.6.0: pcapkit.protocols.transport.sctp.CRC32C_TABLE, with no alias: it is in this
module, and pcapkit.protocols.transport.sctp exports the protocol class alone
(#2534).
pcapkit.protocols.transport.sctp.protocol contains
SCTP,
which implements the extractor for Stream Control
Transmission Protocol (SCTP) [*], whose structure is:
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.protocol.SCTP(file=None, length=None, **kwargs)[source]¶
-
This class implements Stream Control Transmission Protocol.
Unlike
TCPandUDP, SCTP dispatches the next layer on the payload protocol identifier (PPID) each DATA chunk carries, not on a port, soself.__proto__is keyed by PPID and populated throughSCTP.register():>>> from pcapkit.const.sctp.payload_protocol_identifier import PayloadProtocolIdentifier >>> SCTP.register(PayloadProtocolIdentifier.PayloadProtocolIdentifier_3GPP_NG_Application_Protocol, NGAP) >>> SCTP.register(60, NGAP) # equivalent, PPID given as a plain integer
By default, PPIDs 60 (
PayloadProtocolIdentifier_3GPP_NG_Application_Protocol) and 66 (PayloadProtocolIdentifier_3GPP_NGAP_over_DTLS_over_SCTP) are registered toNGAP, and every other PPID resolves toRaw.Only PPID 60 decodes. A PPID 66 payload is an NGAP PDU in a DTLS record, mapped straight to
NGAPrather than throughDTLS, so it always degrades toRaw; it is registered so that the protochain names the PPID.The SCTP chunks it parses, by
pcapkit.const.sctp.chunk.Chunktype: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.The chunk parameters it parses, by
pcapkit.const.sctp.parameter.Parametertype:Parameter Type
Parameter Parser
Parameter Constructor
It parses every error cause RFC 9260 Section 3.3.10 defines, by
pcapkit.const.sctp.cause_code.CauseCodecode, as mapped inself.__cause__. Any other code falls through to_read_cause_donone().Added in version 1.5.0.
Changed in version 1.6.0:
make()and the chunk, parameter and error cause makers raiseProtocolErrorfor an integer field given a value its width cannot hold, a length included, rather than writing its low bits or raising aFieldValueErroror a bareValueError, and for a checksum that is not four octets, rather than padding or cutting it (#2614).A packet the capture cut short of the length an enclosing layer declares, such as an IPv4 Total Length, rebuilds through
from_data()as captured, where it lost the octets after its last whole chunk (#2673).The type of each chunk given to
make(), the type of each parameter and the code of each error cause given to a chunk maker, and each enumeration field of the chunk, parameter and error cause makers – a DATA chunk’s payload protocol identifier, and the parameter types listed by a supported address types parameter or a missing mandatory parameter cause – take a member or anintcode, resolved with the enumeration’sget, and a code no member holds is written as given; a name, aboolfor a field wider than one bit, or a code the field cannot carry raisesProtocolError(#2594).A parameter or an error cause given to a chunk maker as empty raw octets, which hold no type or code, raises
ProtocolErrorrather than anAttributeError(#2723).
- __proto__: DefaultDict[int, ModuleDescriptor[ProtocolBase] | Type[ProtocolBase]]¶
Protocol index mapping for decoding next layer, see
self._decode_next_layer&self._import_next_layer.
- __proto_key__: ClassVar[tuple[Type[EnumRegistry], bool]]¶
What
__proto__is keyed by – the enum a key must be a member of, and whether a bareintis valid too. Read byregister_protocol_code()to check acode=key asregister_sctp()checks its own; a bareintis a PPID (#2268).
- __chunk__: DefaultDict[int, str | tuple[Callable[[Chunk, OrderedMultiDict[Chunk, Chunk]], Chunk], Callable[[Chunk, Chunk | None, Any], Chunk]]]¶
Chunk type to method mapping, see
_read_sctp_chunks()and_make_sctp_chunks(). Astrvalue names the methods_read_chunk_${name}and_make_chunk_${name}, falling back to_read_chunk_donone()and_make_chunk_donone()when the class has no such method; any other value is a(parser, constructor)pair of callables.
- __parameter__: DefaultDict[int, str | tuple[Callable[[Parameter, OrderedMultiDict[Parameter, Parameter]], Parameter], Callable[[Parameter, Parameter | None, Any], Parameter]]]¶
Chunk parameter type to method mapping, see
_read_sctp_parameters()and_make_sctp_parameters(). Astrvalue names the methods_read_param_${name}and_make_param_${name}, falling back to_read_param_donone()and_make_param_donone()when the class has no such method; any other value is a(parser, constructor)pair of callables.
- __cause__: DefaultDict[int, str | tuple[Callable[[ErrorCause, OrderedMultiDict[CauseCode, ErrorCause]], ErrorCause], Callable[[CauseCode, ErrorCause | None, Any], ErrorCause]]]¶
Error cause code to method mapping, see
_read_sctp_causes()and_make_sctp_causes(). Astrvalue names the methods_read_cause_${name}and_make_cause_${name}, falling back to_read_cause_donone()and_make_cause_donone()when the class has no such method; any other value is a(parser, constructor)pair of callables.
- 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, trailer=b'', **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|int,dict[str,Any]] |bytes] |OrderedMultiDict[Chunk,Chunk] |None) – SCTP chunks.trailer (
bytes) – Octets after the last chunk, written as is and covered by the computed checksum.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed packet data.
- Raises:
ProtocolError – If
srcportordstportis abool(#2287),vtagdoes not fit 32 bits,chksumis not four octets, a chunk’s type is a name, abool, or a code the 8-bit type field cannot carry (#2594), or a chunk maker rejects its chunk.
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 fully qualified class name of the new protocol class should be
{protocol.module}.{protocol.name}.- Parameters:
code (
PayloadProtocolIdentifier|int) – payload protocol identifier (PPID), as inPayloadProtocolIdentifierprotocol (
ModuleDescriptor[ProtocolBase] |Type[ProtocolBase]) – module descriptor or aProtocolBasesubclass
Important
SCTP overrides
Transport.registerbecause itsself.__proto__registry is keyed by PPID rather than by port number.- Raises:
pcapkit.utilities.exceptions.RegistryError – If
protocolis not a class, or not aProtocolBasesubclass.- Warns:
pcapkit.utilities.warnings.RegistryWarning– If this PPID is already registered and the incumbent differs from the replacement; the message names both. As with the port-keyedTransport.registerit overrides, an unresolvedModuleDescriptorincumbent counts as different from the class it names; handing back the stored entry, or a descriptor equal to it, is a silent no-op that keeps it, and handing back the descriptor a PPID shipped with restores that object, unresolved (#1504).
- classmethod register_chunk(code, meth)[source]¶
Register a chunk parser.
- Parameters:
- Warns:
RegistryWarning– If a different entry is already registered forcode; it is overwritten. Handing back the entry already stored, or one equal to it, is a silent no-op. Re-registering the entrycodeshipped with is accepted like any other, so an override can be undone (#1362, #1363).
- classmethod register_parameter(code, meth)[source]¶
Register a chunk parameter parser.
- Parameters:
code (
Parameter) – SCTP chunk parameter type.meth (
str|tuple[Callable[[Parameter,OrderedMultiDict[Parameter,Parameter]],Parameter],Callable[[Parameter,Parameter|None,Any],Parameter]]) – Method name, or a(parser, constructor)pair of callables, to parse and construct the parameter; see__parameter__.
- Warns:
RegistryWarning– If a different entry is already registered forcode; it is overwritten. Handing back the entry already stored, or one equal to it, is a silent no-op. Re-registering the entrycodeshipped with is accepted like any other, so an override can be undone (#1362, #1363).
- classmethod register_cause(code, meth)[source]¶
Register an error cause parser.
- Parameters:
code (
CauseCode) – SCTP error cause code.meth (
str|tuple[Callable[[ErrorCause,OrderedMultiDict[CauseCode,ErrorCause]],ErrorCause],Callable[[CauseCode,ErrorCause|None,Any],ErrorCause]]) – Method name, or a(parser, constructor)pair of callables, to parse and construct the cause; see__cause__.
- Warns:
RegistryWarning– If a different entry is already registered forcode; it is overwritten. Handing back the entry already stored, or one equal to it, is a silent no-op. Re-registering the entrycodeshipped with is accepted like any other, so an override can be undone (#1362, #1363).
- static crc32c(data)[source]¶
Calculate the CRC32c of
data.SCTP uses the CRC32c (Castagnoli) polynomial rather than the one’s complement internet checksum used by TCP, UDP and IP. The algorithm is the reflected, table-driven one given by RFC 9260 Appendix A, with the remainder register initialised to all ones and the result complemented.
- 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.
- _read_sctp_chunks()[source]¶
Read SCTP chunk list.
- Return type:
- Returns:
Extracted SCTP chunks.
- Raises:
ProtocolError – If a raw chunk given to
make()is not a whole chunk. Parsed, its octets would fall to the trailer rather than to the chunk list, so it is rejected (#1468).
- _make_sctp_chunks(chunks)[source]¶
Make chunks for SCTP.
- Parameters:
chunks (
list[Chunk|tuple[Chunk|int,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 pads itself to the four-byte boundary required by RFC 9260 Section 3.2. A chunk without a nested list carries its own trailingPaddingField, computed from the chunk’s ownlength; one with a nested parameter or error cause list folds its padding into that list, seenested_length().
- _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 toRawisProtocol._import_next_layer’s job, throughProtocol._lookup_next_layer, which leavesself.__proto__untouched.
- _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.
- _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.
- _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 any null terminator, since the encoding is not specified on the wire. A name captured without a terminator is kept as read and rebuilds as read (#1482).
- _read_param_addrtypes(schema, *, parameters)[source]¶
Read SCTP supported address types parameter.
Structure of SCTP supported address types parameter [RFC 9260 Section 3.3.2.1.5]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 12 | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address Type #1 | Address Type #2 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ...... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters:
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.
- _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_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, *, reserved=0, I=False, U=False, B=True, E=True, tsn=0, stream_id=0, stream_seq=0, ppid=0, data=b'', **kwargs)[source]¶
Make SCTP DATA chunk.
- Parameters:
code (
Chunk) – chunk typereserved (
int) – reserved flag bitsI (
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 identifier, as a member or anintcodedata (
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, a field does not fit its width, orppidis a name, aboolor a code the field cannot carry.
- _make_chunk_init(code, chunk=None, *, flags=b'\x00', init_tag=0, a_rwnd=1500, outbound_streams=1, inbound_streams=1, init_tsn=0, parameters=None, **kwargs)[source]¶
Make SCTP INIT chunk.
- Parameters:
code (
Chunk) – chunk typeflags (
bytes) – raw chunk flags, as a single byteinit_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|int,dict[str,Any]] |bytes] |OrderedMultiDict[Parameter,Parameter] |None) – optional and variable-length parameters**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed chunk schema.
- Raises:
ProtocolError – If
flagsis NOT exactly one byte, or a field does not fit its width.
Note
The chunk flags are reserved by RFC 9260 Section 3.3.2, so they default to zero; a parsed chunk’s flags are kept as received.
- _make_chunk_init_ack(code, chunk=None, *, flags=b'\x00', init_tag=0, a_rwnd=1500, outbound_streams=1, inbound_streams=1, init_tsn=0, parameters=None, **kwargs)[source]¶
Make SCTP INIT ACK chunk.
- Parameters:
code (
Chunk) – chunk typechunk (
INITACKChunk|None) – chunk dataflags (
bytes) – raw chunk flags, as a single byteinit_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|int,dict[str,Any]] |bytes] |OrderedMultiDict[Parameter,Parameter] |None) – optional and variable-length parameters**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed chunk schema.
- Raises:
ProtocolError – If
flagsis NOT exactly one byte, or a field does not fit its width.
- _make_chunk_sack(code, chunk=None, *, flags=b'\x00', cum_tsn_ack=0, a_rwnd=1500, gap_blocks=None, dup_tsn=None, **kwargs)[source]¶
Make SCTP SACK chunk.
- Parameters:
code (
Chunk) – chunk typeflags (
bytes) – raw chunk flags, as a single bytecum_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.
- Raises:
ProtocolError – If
flagsis NOT exactly one byte, or a field, a gap ack block’s offset or a duplicate TSN does not fit its width.
Note
The counts of gap ack blocks and duplicate TSNs are derived from the supplied lists rather than taken as arguments, so that they cannot disagree with the lists they count.
- _make_chunk_heartbeat(code, chunk=None, *, flags=b'\x00', parameters=None, **kwargs)[source]¶
Make SCTP HEARTBEAT chunk.
- Parameters:
code (
Chunk) – chunk typechunk (
HeartbeatChunk|None) – chunk dataflags (
bytes) – raw chunk flags, as a single byteparameters (
list[Parameter|tuple[Parameter|int,dict[str,Any]] |bytes] |OrderedMultiDict[Parameter,Parameter] |None) – heartbeat information parameters**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed chunk schema.
- Raises:
ProtocolError – If
flagsis NOT exactly one byte.
- _make_chunk_heartbeat_ack(code, chunk=None, *, flags=b'\x00', parameters=None, **kwargs)[source]¶
Make SCTP HEARTBEAT ACK chunk.
- Parameters:
code (
Chunk) – chunk typechunk (
HeartbeatACKChunk|None) – chunk dataflags (
bytes) – raw chunk flags, as a single byteparameters (
list[Parameter|tuple[Parameter|int,dict[str,Any]] |bytes] |OrderedMultiDict[Parameter,Parameter] |None) – heartbeat information parameters**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed chunk schema.
- Raises:
ProtocolError – If
flagsis NOT exactly one byte.
- _make_chunk_abort(code, chunk=None, *, reserved=0, T=False, error=None, **kwargs)[source]¶
Make SCTP ABORT chunk.
- Parameters:
code (
Chunk) – chunk typechunk (
AbortChunk|None) – chunk datareserved (
int) – reserved flag bitsT (
bool) – whether the verification tag has been reflectederror (
list[ErrorCause|tuple[CauseCode|int,dict[str,Any]] |bytes] |OrderedMultiDict[CauseCode,ErrorCause] |None) – zero or more error causes**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed chunk schema.
- Raises:
ProtocolError – If
reserveddoes not fit 7 bits.
- _make_chunk_shutdown(code, chunk=None, *, flags=b'\x00', cum_tsn_ack=0, **kwargs)[source]¶
Make SCTP SHUTDOWN chunk.
- Parameters:
- Return type:
- Returns:
Constructed chunk schema.
- Raises:
ProtocolError – If
flagsis NOT exactly one byte, orcum_tsn_ackdoes not fit 32 bits.
- _make_chunk_shutdown_ack(code, chunk=None, *, flags=b'\x00', **kwargs)[source]¶
Make SCTP SHUTDOWN ACK chunk.
- Parameters:
code (
Chunk) – chunk typechunk (
ShutdownACKChunk|None) – chunk dataflags (
bytes) – raw chunk flags, as a single byte**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed chunk schema.
- Raises:
ProtocolError – If
flagsis NOT exactly one byte.
- _make_chunk_error(code, chunk=None, *, flags=b'\x00', error=None, **kwargs)[source]¶
Make SCTP ERROR chunk.
- Parameters:
code (
Chunk) – chunk typechunk (
ErrorChunk|None) – chunk dataflags (
bytes) – raw chunk flags, as a single byteerror (
list[ErrorCause|tuple[CauseCode|int,dict[str,Any]] |bytes] |OrderedMultiDict[CauseCode,ErrorCause] |None) – one or more error causes**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed chunk schema.
- Raises:
ProtocolError – If
flagsis NOT exactly one byte.
- _make_chunk_cookie_echo(code, chunk=None, *, flags=b'\x00', cookie=b'', **kwargs)[source]¶
Make SCTP COOKIE ECHO chunk.
- Parameters:
- Return type:
- Returns:
Constructed chunk schema.
- Raises:
ProtocolError – If
flagsis NOT exactly one byte.
- _make_chunk_cookie_ack(code, chunk=None, *, flags=b'\x00', **kwargs)[source]¶
Make SCTP COOKIE ACK chunk.
- Parameters:
code (
Chunk) – chunk typechunk (
CookieACKChunk|None) – chunk dataflags (
bytes) – raw chunk flags, as a single byte**kwargs (
Any) – arbitrary keyword arguments
- Return type:
- Returns:
Constructed chunk schema.
- Raises:
ProtocolError – If
flagsis NOT exactly one byte.
- _make_chunk_shutdown_complete(code, chunk=None, *, reserved=0, T=False, **kwargs)[source]¶
Make SCTP SHUTDOWN COMPLETE chunk.
- Parameters:
- Return type:
- Returns:
Constructed chunk schema.
- Raises:
ProtocolError – If
reserveddoes not fit 7 bits.
- _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.
- Raises:
ProtocolError – If
incrementdoes not fit 32 bits.
- _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 a user-supplied
nameis not null-terminated, as required by RFC 9260 Section 3.3.2.1.4.
Note
A parsed
paramcarries its name as captured, so a name the reader accepted without a terminator rebuilds as read (#1482). The terminator check applies tonameonly.
- _make_param_addrtypes(code, param=None, *, types=None, **kwargs)[source]¶
Make SCTP supported address types parameter.
- Parameters:
- Return type:
- Returns:
Constructed parameter schema.
- Raises:
ProtocolError – If an item of
typesis not a parameter type, as_make_param_types()checks.
- _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, reserved=b'\x00\x00', **kwargs)[source]¶
Make SCTP invalid stream identifier error cause.
- Parameters:
- Return type:
- Returns:
Constructed error cause schema.
- Raises:
ProtocolError – If
reservedis NOT exactly two bytes, orstream_iddoes not fit 16 bits.
- _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.
- Raises:
ProtocolError – If an item of
typesis not a parameter type, as_make_param_types()checks.
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.
- Raises:
ProtocolError – If
stalenessdoes not fit 32 bits.
- _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.
- Raises:
ProtocolError – If
tsndoes not fit 32 bits.
- _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.
- _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.
- _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_parameters(parameters)[source]¶
Make chunk parameters for SCTP.
- Parameters:
parameters (
list[Parameter|tuple[Parameter|int,dict[str,Any]] |bytes] |OrderedMultiDict[Parameter,Parameter]) – SCTP chunk parameters.- Return type:
- Returns:
Constructed parameter schemas.
- Raises:
ProtocolError – If the type of a parameter, given in a
(type, kwargs)pair or as the key of a container, is a name, aboolor a code its field cannot carry, or if a parameter given as raw octets is empty (#2723).
- _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|int,dict[str,Any]] |bytes] |OrderedMultiDict[CauseCode,ErrorCause]) – SCTP error causes.- Return type:
list[ErrorCause|bytes]- Returns:
Constructed error cause schemas.
- Raises:
ProtocolError – If the code of an error cause, given in a
(code, kwargs)pair or as the key of a container, is a name, aboolor a code its field cannot carry, or if an error cause given as raw octets is empty (#2723).
- _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.
- _make_param_types(types)[source]¶
Resolve a list of parameter types.
Shared by
_make_param_addrtypes()and_make_cause_missing_param(), whosetypesboth list parameter types.- Parameters:
types (
list[Parameter|int] |None) – parameter types, each given as aParametermember or anintcode- Return type:
- Returns:
The
Parametermember each item resolves to withget, or the code itself where no member holds it.- Raises:
ProtocolError – If an item is a
bool(#2288), a name, any other non-int, or a code the 16-bit parameter type field cannot carry (#2594).
Header Schemas¶
Removed in version 1.6.0: pcapkit.protocols.schema.transport.sctp, with no alias: the module moved here
(#2534).
- class pcapkit.protocols.transport.sctp.schema.SCTP(srcport=NO_VALUE, dstport=NO_VALUE, vtag=NO_VALUE, chksum=NO_VALUE, chunks=NO_VALUE, trailer=NO_VALUE, *, __packet__=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.- chksum: bytes = <BytesField chksum>¶
Checksum, as a CRC32c over the whole packet with this field zeroed.
- trailer: bytes = <PayloadField trailer>¶
Octets captured after the last whole chunk, see
ChunkListFieldandIPv4.trailer.
- class pcapkit.protocols.transport.sctp.schema.Chunk(*args, **kwargs)[source]¶
Bases:
EnumSchema[Chunk]Header schema for SCTP chunks.
- pre_pack(packet)[source]¶
Prepare
packetdata for packing process; seepre_pack_padding().
- class pcapkit.protocols.transport.sctp.schema.UnknownChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, value=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP chunks with unknown types.
- class pcapkit.protocols.transport.sctp.schema.DATAChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, tsn=NO_VALUE, stream_id=NO_VALUE, stream_seq=NO_VALUE, ppid=NO_VALUE, data=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP DATA chunks.
- flags: DATAChunkFlags = <BitField flags>¶
Chunk flags.
- ppid: PayloadProtocolIdentifier = <EnumField ppid>¶
Payload protocol identifier.
- class pcapkit.protocols.transport.sctp.schema.INITChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, init_tag=NO_VALUE, a_rwnd=NO_VALUE, outbound_streams=NO_VALUE, inbound_streams=NO_VALUE, init_tsn=NO_VALUE, parameters=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP INIT chunks.
- parameters: list[Parameter] = <PaddedOptionField parameters>¶
Optional and variable-length parameters, including the chunk’s own trailing padding; see
nested_length().
- class pcapkit.protocols.transport.sctp.schema.INITACKChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, init_tag=NO_VALUE, a_rwnd=NO_VALUE, outbound_streams=NO_VALUE, inbound_streams=NO_VALUE, init_tsn=NO_VALUE, parameters=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP INIT ACK chunks.
- parameters: list[Parameter] = <PaddedOptionField parameters>¶
Optional and variable-length parameters, including the chunk’s own trailing padding; see
nested_length().
- class pcapkit.protocols.transport.sctp.schema.SACKChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, cum_tsn_ack=NO_VALUE, a_rwnd=NO_VALUE, num_gap_blocks=NO_VALUE, num_dup_tsn=NO_VALUE, gap_blocks=NO_VALUE, dup_tsn=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP SACK chunks.
- gap_blocks: list[GapAckBlock] = <ListField gap_blocks>¶
Gap ack blocks.
- class pcapkit.protocols.transport.sctp.schema.HeartbeatChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, parameters=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP HEARTBEAT chunks.
- parameters: list[Parameter] = <PaddedOptionField parameters>¶
Heartbeat information parameters, including the chunk’s own trailing padding; see
nested_length().
- class pcapkit.protocols.transport.sctp.schema.HeartbeatACKChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, parameters=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP HEARTBEAT ACK chunks.
- parameters: list[Parameter] = <PaddedOptionField parameters>¶
Heartbeat information parameters, including the chunk’s own trailing padding; see
nested_length().
- class pcapkit.protocols.transport.sctp.schema.AbortChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, error=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP ABORT chunks.
- error: list[ErrorCause] = <PaddedOptionField error>¶
Zero or more error causes, including the chunk’s own trailing padding; see
nested_length().
- class pcapkit.protocols.transport.sctp.schema.ShutdownChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, cum_tsn_ack=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP SHUTDOWN chunks.
- class pcapkit.protocols.transport.sctp.schema.ShutdownACKChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP SHUTDOWN ACK chunks.
- class pcapkit.protocols.transport.sctp.schema.ErrorChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, error=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP ERROR chunks.
- error: list[ErrorCause] = <PaddedOptionField error>¶
One or more error causes, including the chunk’s own trailing padding; see
nested_length().
- class pcapkit.protocols.transport.sctp.schema.CookieEchoChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, cookie=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP COOKIE ECHO chunks.
- class pcapkit.protocols.transport.sctp.schema.CookieACKChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP COOKIE ACK chunks.
- class pcapkit.protocols.transport.sctp.schema.ShutdownCompleteChunk(type=NO_VALUE, flags=NO_VALUE, length=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ChunkHeader schema for SCTP SHUTDOWN COMPLETE chunks.
- class pcapkit.protocols.transport.sctp.schema.GapAckBlock(start=NO_VALUE, end=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for SCTP SACK chunk gap ack blocks.
- class pcapkit.protocols.transport.sctp.schema.Parameter(*args, **kwargs)[source]¶
Bases:
EnumSchema[Parameter]Header schema for SCTP chunk parameters.
- pre_pack(packet)[source]¶
Prepare
packetdata for packing process; seepre_pack_padding().
- class pcapkit.protocols.transport.sctp.schema.UnknownParameter(type=NO_VALUE, length=NO_VALUE, value=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP chunk parameters with unknown types.
- class pcapkit.protocols.transport.sctp.schema.HeartbeatInfoParameter(type=NO_VALUE, length=NO_VALUE, info=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP heartbeat info parameter.
- class pcapkit.protocols.transport.sctp.schema.IPv4AddressParameter(type=NO_VALUE, length=NO_VALUE, address=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP IPv4 address parameter.
- address: IPv4Address = <IPv4AddressField address>¶
IPv4 address of the sending endpoint.
- class pcapkit.protocols.transport.sctp.schema.IPv6AddressParameter(type=NO_VALUE, length=NO_VALUE, address=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP IPv6 address parameter.
- address: IPv6Address = <IPv6AddressField address>¶
IPv6 address of the sending endpoint.
- class pcapkit.protocols.transport.sctp.schema.StateCookieParameter(type=NO_VALUE, length=NO_VALUE, cookie=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP state cookie parameter.
- class pcapkit.protocols.transport.sctp.schema.UnrecognizedParameter(type=NO_VALUE, length=NO_VALUE, value=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP unrecognized parameter parameter.
- class pcapkit.protocols.transport.sctp.schema.CookiePreservativeParameter(type=NO_VALUE, length=NO_VALUE, increment=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP cookie preservative parameter.
- class pcapkit.protocols.transport.sctp.schema.HostNameAddressParameter(type=NO_VALUE, length=NO_VALUE, name=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP host name address parameter.
- name: bytes = <BytesField name>¶
Host name as captured. RFC 9260 Section 3.3.2.1.4 asks for at least one null terminator, but a parsed name may lack it.
- class pcapkit.protocols.transport.sctp.schema.SupportedAddressTypesParameter(type=NO_VALUE, length=NO_VALUE, types=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ParameterHeader schema for SCTP supported address types parameter.
- class pcapkit.protocols.transport.sctp.schema.ErrorCause(*args, **kwargs)[source]¶
Bases:
EnumSchema[CauseCode]Header schema for SCTP error causes.
- pre_pack(packet)[source]¶
Prepare
packetdata for packing process; seepre_pack_padding().
- class pcapkit.protocols.transport.sctp.schema.UnknownCause(code=NO_VALUE, length=NO_VALUE, value=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP error causes with unknown cause codes.
- class pcapkit.protocols.transport.sctp.schema.InvalidStreamIdentifierCause(code=NO_VALUE, length=NO_VALUE, stream_id=NO_VALUE, reserved=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP invalid stream identifier error cause.
- class pcapkit.protocols.transport.sctp.schema.MissingMandatoryParameterCause(code=NO_VALUE, length=NO_VALUE, num=NO_VALUE, types=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP missing mandatory parameter error cause.
- class pcapkit.protocols.transport.sctp.schema.StaleCookieCause(code=NO_VALUE, length=NO_VALUE, staleness=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP stale cookie error cause.
- class pcapkit.protocols.transport.sctp.schema.OutOfResourceCause(code=NO_VALUE, length=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP out of resource error cause.
- class pcapkit.protocols.transport.sctp.schema.UnresolvableAddressCause(code=NO_VALUE, length=NO_VALUE, value=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP unresolvable address error cause.
- class pcapkit.protocols.transport.sctp.schema.UnrecognizedChunkTypeCause(code=NO_VALUE, length=NO_VALUE, value=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP unrecognized chunk type error cause.
- class pcapkit.protocols.transport.sctp.schema.InvalidMandatoryParameterCause(code=NO_VALUE, length=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP invalid mandatory parameter error cause.
- class pcapkit.protocols.transport.sctp.schema.UnrecognizedParametersCause(code=NO_VALUE, length=NO_VALUE, value=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP unrecognized parameters error cause.
- class pcapkit.protocols.transport.sctp.schema.NoUserDataCause(code=NO_VALUE, length=NO_VALUE, tsn=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP no user data error cause.
- class pcapkit.protocols.transport.sctp.schema.CookieReceivedWhileShuttingDownCause(code=NO_VALUE, length=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP cookie received while shutting down error cause.
- class pcapkit.protocols.transport.sctp.schema.RestartOfAnAssociationWithNewAddressesCause(code=NO_VALUE, length=NO_VALUE, value=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP restart of an association with new addresses error cause.
- class pcapkit.protocols.transport.sctp.schema.UserInitiatedAbortCause(code=NO_VALUE, length=NO_VALUE, info=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP user-initiated abort error cause.
- class pcapkit.protocols.transport.sctp.schema.ProtocolViolationCause(code=NO_VALUE, length=NO_VALUE, info=NO_VALUE, padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ErrorCauseHeader schema for SCTP protocol violation error cause.
- class pcapkit.protocols.transport.sctp.schema.PaddedOptionField(length=lambda _: ..., base_schema=None, type_name='type', registry=None, eool=None, callback=lambda *_: ...)[source]¶
Bases:
OptionFieldList of chunks, parameters or error causes, the last of which may be cut inside its trailing padding.
OptionField.unpackrefuses an item that reads past the end of the data (#1325). The last chunk of a packet may lack (some of) its padding, though, and so may the last parameter or cause of that chunk, which share it (nested_length()). An item’slengthleaves its padding out and the receiver ignores it (RFC 9260 Section 3.2), andChunkListFieldhands on only chunks whoselengthoctets are all present, so an item short of its padding alone is cut rather than overrun. It records that as a short read of itspadding, and is kept (#2680).
- class pcapkit.protocols.transport.sctp.schema.ChunkListField(length=lambda _: ..., base_schema=None, type_name='type', registry=None, eool=None, callback=lambda *_: ...)[source]¶
Bases:
PaddedOptionFieldChunk list that stops at the last whole chunk.
SCTP has no packet length field, so octets after the last whole chunk – fewer than a chunk header, or a chunk whose
lengthruns past the data – cannot be told apart from a chunk cut short. They are not parsed but reported as option padding, whichSchema.unpackhands back to the stream forSCTP.trailerto keep as captured (#1468). The padding is the rest of the area declared, as for anyOptionField, so an area the data ends inside hands back only the octets present (#2685). The last whole chunk may be cut inside its padding, and is kept asPaddedOptionFieldkeeps one (#2680).
Type Stubs¶
Auxiliary Functions¶
- pcapkit.protocols.transport.sctp.schema.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 the
lengthcalls for. A final chunk captured without (all of) its padding, although RFC 9260 Section 3.2 has the sender pad every chunk, reads short, whichSchema.unpackrecords so thatSchema.packwrites back only the octets read, andPaddedOptionFieldlets it parse (#2680). When packing, it is clamped to the__padding__widthpre_pack_padding()hands over, so such a chunk rebuilt from its data model is short of its padding as well (#1474).
- pcapkit.protocols.transport.sctp.schema.pre_pack_padding(schema, packet)[source]¶
Hand a schema’s recorded padding width to
padding_length().- Parameters:
A schema whose padding was captured short – only the last chunk of a packet can be – carries the width as captured under
__padding__in its__dict__, set by_restore_paddinginpcapkit.protocols.transport.sctp.protocolfrom the chunk’spaddingas parsed (#1474). The key is written topacketfor every schema,Nonewhen there is no record, sinceSchema.packshares onepacketmapping across siblings and a record left behind by one would otherwise shorten the padding of the next.
- pcapkit.protocols.transport.sctp.schema.bounded(length)[source]¶
Clamp a list field’s computed length to the bytes actually available.
- Parameters:
length (
Callable[[dict[str,Any]],int]) – Callback computing the field’s nominal length.- Return type:
- Returns:
A callback returning that length, never exceeding the bytes left in the enclosing structure.
A count field and the list it counts can disagree on a malformed packet, and
ListField.unpacksubtracts the parsed size of each item from its budget – so aSchemaFielditem that runs out of bytes parses to nothing, subtracts nothing, and the loop never terminates. Clamping to the bytes on hand turns that hang into a short list, which the read handlers then reject against the declared length.Only list fields are wrapped:
ListField.packignores the length entirely, so clamping cannot truncate anything on construction.
- pcapkit.protocols.transport.sctp.schema.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, which parsing and construction each need for a reason of their own:On parsing, a sender is allowed by RFC 9260 Section 3.2 to leave the final parameter’s padding out of the chunk length, so the padding has to be consumed whether or not the length accounts for it. Folding it into the list’s span does that, and leaves it visible as the field’s
__option_padding__. The last chunk of a packet may omit that padding altogether, so the chunks wrap this callback inbounded(): the span then ends with the data, and the final parameter or cause reads only the padding that is there (#1479), recording the cut (#2680).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: every nested parameter packs its own padding, the last one’s included, so the list already ends on a four-byte boundary whether or not the chunk length counts that final padding.
- pcapkit.protocols.transport.sctp.schema.whole_chunks_length(data)[source]¶
Length of the run of whole chunks at the front of
data.- Parameters:
data (
bytes) – Chunk area of an SCTP packet.- Return type:
- Returns:
Number of octets up to the end of the last chunk whose declared
lengthoctets are all present, with as much of its padding as there is, seePaddedOptionField. Alengthbelow the four-octet chunk header (RFC 9260 Section 3.2) delimits nothing, so the run stops there too; four zero octets would otherwise read as a DATA chunk.
Data Models¶
Removed in version 1.6.0: pcapkit.protocols.data.transport.sctp, with no alias: the module moved here
(#2534).
- class pcapkit.protocols.transport.sctp.data.SCTP(srcport, dstport, vtag, chksum, chunks)[source]¶
Bases:
ProtocolData model for SCTP packet.
- chunks: OrderedMultiInfo[Chunk, Chunk]¶
Chunks.
- class pcapkit.protocols.transport.sctp.data.DATAChunkFlags(reserved, I, U, B, E)[source]¶
Bases:
DataData model for SCTP DATA chunk flags.
- class pcapkit.protocols.transport.sctp.data.TBitFlags(reserved, T)[source]¶
Bases:
DataData model for SCTP chunk flags carrying only the T bit, i.e., ABORT and SHUTDOWN COMPLETE chunks.
- class pcapkit.protocols.transport.sctp.data.GapAckBlock(start, end)[source]¶
Bases:
DataData model for SCTP SACK chunk gap ack blocks.
- class pcapkit.protocols.transport.sctp.data.Chunk(*args, **kwargs)[source]¶
Bases:
DataData model for SCTP chunks.
- padding: bytes¶
Trailing padding octets, as captured; present only when they are not all zeros, or fewer than the
lengthcalls for (#1474). Read back byfrom_dataonly, where fewer octets are honoured on the last item of its list alone and zero-filled to the full width anywhere else.makebuilds from keywords and takes nopadding: every item it builds is padded in zeros.
- class pcapkit.protocols.transport.sctp.data.UnknownChunk(type, length, flags, value)[source]¶
Bases:
ChunkData model for SCTP chunks with unknown types.
- class pcapkit.protocols.transport.sctp.data.DATAChunk(type, length, flags, tsn, stream_id, stream_seq, ppid, data)[source]¶
Bases:
ChunkData model for SCTP DATA chunks.
- flags: DATAChunkFlags¶
Chunk flags.
- ppid: PayloadProtocolIdentifier¶
Payload protocol identifier.
- class pcapkit.protocols.transport.sctp.data.INITChunk(type, length, flags, init_tag, a_rwnd, outbound_streams, inbound_streams, init_tsn, parameters)[source]¶
Bases:
ChunkData model for SCTP INIT chunks.
- parameters: OrderedMultiInfo[Parameter, Parameter]¶
Optional and variable-length parameters.
- class pcapkit.protocols.transport.sctp.data.INITACKChunk(type, length, flags, init_tag, a_rwnd, outbound_streams, inbound_streams, init_tsn, parameters)[source]¶
Bases:
ChunkData model for SCTP INIT ACK chunks.
- parameters: OrderedMultiInfo[Parameter, Parameter]¶
Optional and variable-length parameters.
- class pcapkit.protocols.transport.sctp.data.SACKChunk(type, length, flags, cum_tsn_ack, a_rwnd, num_gap_blocks, num_dup_tsn, gap_blocks, dup_tsn)[source]¶
Bases:
ChunkData model for SCTP SACK chunks.
- gap_blocks: tuple[GapAckBlock, ...]¶
Gap ack blocks.
- class pcapkit.protocols.transport.sctp.data.HeartbeatChunk(type, length, flags, parameters)[source]¶
Bases:
ChunkData model for SCTP HEARTBEAT chunks.
- parameters: OrderedMultiInfo[Parameter, Parameter]¶
Heartbeat information parameters.
- class pcapkit.protocols.transport.sctp.data.HeartbeatACKChunk(type, length, flags, parameters)[source]¶
Bases:
ChunkData model for SCTP HEARTBEAT ACK chunks.
- parameters: OrderedMultiInfo[Parameter, Parameter]¶
Heartbeat information parameters.
- class pcapkit.protocols.transport.sctp.data.AbortChunk(type, length, flags, error)[source]¶
Bases:
ChunkData model for SCTP ABORT chunks.
- error: OrderedMultiInfo[CauseCode, ErrorCause]¶
Zero or more error causes.
- class pcapkit.protocols.transport.sctp.data.ShutdownChunk(type, length, flags, cum_tsn_ack)[source]¶
Bases:
ChunkData model for SCTP SHUTDOWN chunks.
- class pcapkit.protocols.transport.sctp.data.ShutdownACKChunk(type, length, flags)[source]¶
Bases:
ChunkData model for SCTP SHUTDOWN ACK chunks.
- class pcapkit.protocols.transport.sctp.data.ErrorChunk(type, length, flags, error)[source]¶
Bases:
ChunkData model for SCTP ERROR chunks.
- error: OrderedMultiInfo[CauseCode, ErrorCause]¶
One or more error causes.
- class pcapkit.protocols.transport.sctp.data.CookieEchoChunk(type, length, flags, cookie)[source]¶
Bases:
ChunkData model for SCTP COOKIE ECHO chunks.
- class pcapkit.protocols.transport.sctp.data.CookieACKChunk(type, length, flags)[source]¶
Bases:
ChunkData model for SCTP COOKIE ACK chunks.
- class pcapkit.protocols.transport.sctp.data.ShutdownCompleteChunk(type, length, flags)[source]¶
Bases:
ChunkData model for SCTP SHUTDOWN COMPLETE chunks.
- class pcapkit.protocols.transport.sctp.data.Parameter(*args, **kwargs)[source]¶
Bases:
DataData model for SCTP chunk parameters.
- padding: bytes¶
Trailing padding octets, as captured; present only when they are not all zeros, or fewer than the
lengthcalls for (#1474). Read back byfrom_dataonly, where fewer octets are honoured on the last item of its list alone and zero-filled to the full width anywhere else.makebuilds from keywords and takes nopadding: every item it builds is padded in zeros.
- class pcapkit.protocols.transport.sctp.data.UnknownParameter(type, length, value)[source]¶
Bases:
ParameterData model for SCTP chunk parameters with unknown types.
- class pcapkit.protocols.transport.sctp.data.HeartbeatInfoParameter(type, length, info)[source]¶
Bases:
ParameterData model for SCTP heartbeat info parameter.
- class pcapkit.protocols.transport.sctp.data.IPv4AddressParameter(type, length, address)[source]¶
Bases:
ParameterData model for SCTP IPv4 address parameter.
- address: IPv4Address¶
IPv4 address of the sending endpoint.
- class pcapkit.protocols.transport.sctp.data.IPv6AddressParameter(type, length, address)[source]¶
Bases:
ParameterData model for SCTP IPv6 address parameter.
- address: IPv6Address¶
IPv6 address of the sending endpoint.
- class pcapkit.protocols.transport.sctp.data.StateCookieParameter(type, length, cookie)[source]¶
Bases:
ParameterData model for SCTP state cookie parameter.
- class pcapkit.protocols.transport.sctp.data.UnrecognizedParameter(type, length, value)[source]¶
Bases:
ParameterData model for SCTP unrecognized parameter parameter.
- class pcapkit.protocols.transport.sctp.data.CookiePreservativeParameter(type, length, increment)[source]¶
Bases:
ParameterData model for SCTP cookie preservative parameter.
- class pcapkit.protocols.transport.sctp.data.HostNameAddressParameter(type, length, name)[source]¶
Bases:
ParameterData model for SCTP host name address parameter.
- class pcapkit.protocols.transport.sctp.data.SupportedAddressTypesParameter(type, length, types)[source]¶
Bases:
ParameterData model for SCTP supported address types parameter.
- class pcapkit.protocols.transport.sctp.data.ErrorCause(*args, **kwargs)[source]¶
Bases:
DataData model for SCTP error causes.
- padding: bytes¶
Trailing padding octets, as captured; present only when they are not all zeros, or fewer than the
lengthcalls for (#1474). Read back byfrom_dataonly, where fewer octets are honoured on the last item of its list alone and zero-filled to the full width anywhere else.makebuilds from keywords and takes nopadding: every item it builds is padded in zeros.
- class pcapkit.protocols.transport.sctp.data.UnknownCause(code, length, value)[source]¶
Bases:
ErrorCauseData model for SCTP error causes with unknown cause codes.
- class pcapkit.protocols.transport.sctp.data.InvalidStreamIdentifierCause(code, length, stream_id, reserved)[source]¶
Bases:
ErrorCauseData model for SCTP invalid stream identifier error cause.
- class pcapkit.protocols.transport.sctp.data.MissingMandatoryParameterCause(code, length, num, types)[source]¶
Bases:
ErrorCauseData model for SCTP missing mandatory parameter error cause.
- class pcapkit.protocols.transport.sctp.data.StaleCookieCause(code, length, staleness)[source]¶
Bases:
ErrorCauseData model for SCTP stale cookie error cause.
- class pcapkit.protocols.transport.sctp.data.OutOfResourceCause(code, length)[source]¶
Bases:
ErrorCauseData model for SCTP out of resource error cause.
- class pcapkit.protocols.transport.sctp.data.UnresolvableAddressCause(code, length, value)[source]¶
Bases:
ErrorCauseData model for SCTP unresolvable address error cause.
- class pcapkit.protocols.transport.sctp.data.UnrecognizedChunkTypeCause(code, length, value)[source]¶
Bases:
ErrorCauseData model for SCTP unrecognized chunk type error cause.
- class pcapkit.protocols.transport.sctp.data.InvalidMandatoryParameterCause(code, length)[source]¶
Bases:
ErrorCauseData model for SCTP invalid mandatory parameter error cause.
- class pcapkit.protocols.transport.sctp.data.UnrecognizedParametersCause(code, length, value)[source]¶
Bases:
ErrorCauseData model for SCTP unrecognized parameters error cause.
- class pcapkit.protocols.transport.sctp.data.NoUserDataCause(code, length, tsn)[source]¶
Bases:
ErrorCauseData model for SCTP no user data error cause.
- class pcapkit.protocols.transport.sctp.data.CookieReceivedWhileShuttingDownCause(code, length)[source]¶
Bases:
ErrorCauseData model for SCTP cookie received while shutting down error cause.
- class pcapkit.protocols.transport.sctp.data.RestartOfAnAssociationWithNewAddressesCause(code, length, value)[source]¶
Bases:
ErrorCauseData model for SCTP restart of an association with new addresses error cause.
- class pcapkit.protocols.transport.sctp.data.UserInitiatedAbortCause(code, length, info)[source]¶
Bases:
ErrorCauseData model for SCTP user-initiated abort error cause.
- class pcapkit.protocols.transport.sctp.data.ProtocolViolationCause(code, length, info)[source]¶
Bases:
ErrorCauseData model for SCTP protocol violation error cause.
Footnotes