📄 sctp.h
字号:
__u8 body[0];
} __attribute__((packed)) sctp_cookie_param_t;
/* Section 3.3.3.1 Unrecognized Parameters (8) */
typedef struct sctp_unrecognized_param {
sctp_paramhdr_t param_hdr;
sctp_paramhdr_t unrecognized;
} __attribute__((packed)) sctp_unrecognized_param_t;
/*
* 3.3.4 Selective Acknowledgement (SACK) (3):
*
* This chunk is sent to the peer endpoint to acknowledge received DATA
* chunks and to inform the peer endpoint of gaps in the received
* subsequences of DATA chunks as represented by their TSNs.
*/
typedef struct sctp_gap_ack_block {
__u16 start;
__u16 end;
} __attribute__((packed)) sctp_gap_ack_block_t;
typedef uint32_t sctp_dup_tsn_t;
typedef union {
sctp_gap_ack_block_t gab;
sctp_dup_tsn_t dup;
} sctp_sack_variable_t;
typedef struct sctp_sackhdr {
__u32 cum_tsn_ack;
__u32 a_rwnd;
__u16 num_gap_ack_blocks;
__u16 num_dup_tsns;
sctp_sack_variable_t variable[0];
} __attribute__((packed)) sctp_sackhdr_t;
typedef struct sctp_sack_chunk {
sctp_chunkhdr_t chunk_hdr;
sctp_sackhdr_t sack_hdr;
} __attribute__((packed)) sctp_sack_chunk_t;
/* RFC 2960. Section 3.3.5 Heartbeat Request (HEARTBEAT) (4):
*
* An endpoint should send this chunk to its peer endpoint to probe the
* reachability of a particular destination transport address defined in
* the present association.
*/
typedef struct sctp_heartbeathdr {
sctp_paramhdr_t info;
} __attribute__((packed)) sctp_heartbeathdr_t;
typedef struct sctp_heartbeat_chunk {
sctp_chunkhdr_t chunk_hdr;
sctp_heartbeathdr_t hb_hdr;
} __attribute__((packed)) sctp_heartbeat_chunk_t;
/* For the abort and shutdown ACK we must carry the init tag in the
* common header. Just the common header is all that is needed with a
* chunk descriptor.
*/
typedef struct sctp_abort_chunk {
sctp_chunkhdr_t uh;
} __attribute__((packed)) sctp_abort_chunk_t;
/* For the graceful shutdown we must carry the tag (in common header)
* and the highest consecutive acking value.
*/
typedef struct sctp_shutdownhdr {
__u32 cum_tsn_ack;
} __attribute__((packed)) sctp_shutdownhdr_t;
struct sctp_shutdown_chunk_t {
sctp_chunkhdr_t chunk_hdr;
sctp_shutdownhdr_t shutdown_hdr;
} __attribute__ ((packed));
/* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */
typedef struct sctp_errhdr {
__u16 cause;
__u16 length;
__u8 variable[0];
} __attribute__((packed)) sctp_errhdr_t;
typedef struct sctp_operr_chunk {
sctp_chunkhdr_t chunk_hdr;
sctp_errhdr_t err_hdr;
} __attribute__((packed)) sctp_operr_chunk_t;
/* RFC 2960 3.3.10 - Operation Error
*
* Cause Code: 16 bits (unsigned integer)
*
* Defines the type of error conditions being reported.
* Cause Code
* Value Cause Code
* --------- ----------------
* 1 Invalid Stream Identifier
* 2 Missing Mandatory Parameter
* 3 Stale Cookie Error
* 4 Out of Resource
* 5 Unresolvable Address
* 6 Unrecognized Chunk Type
* 7 Invalid Mandatory Parameter
* 8 Unrecognized Parameters
* 9 No User Data
* 10 Cookie Received While Shutting Down
*/
typedef enum {
SCTP_ERROR_NO_ERROR = __constant_htons(0x00),
SCTP_ERROR_INV_STRM = __constant_htons(0x01),
SCTP_ERROR_MISS_PARAM = __constant_htons(0x02),
SCTP_ERROR_STALE_COOKIE = __constant_htons(0x03),
SCTP_ERROR_NO_RESOURCE = __constant_htons(0x04),
SCTP_ERROR_DNS_FAILED = __constant_htons(0x05),
SCTP_ERROR_UNKNOWN_CHUNK = __constant_htons(0x06),
SCTP_ERROR_INV_PARAM = __constant_htons(0x07),
SCTP_ERROR_UNKNOWN_PARAM = __constant_htons(0x08),
SCTP_ERROR_NO_DATA = __constant_htons(0x09),
SCTP_ERROR_COOKIE_IN_SHUTDOWN = __constant_htons(0x0a),
/* SCTP Implementation Guide:
* 11 Restart of an association with new addresses
* 12 User Initiated Abort
* 13 Protocol Violation
*/
SCTP_ERROR_RESTART = __constant_htons(0x0b),
SCTP_ERROR_USER_ABORT = __constant_htons(0x0c),
SCTP_ERROR_PROTO_VIOLATION = __constant_htons(0x0d),
/* ADDIP Section 3.3 New Error Causes
*
* Four new Error Causes are added to the SCTP Operational Errors,
* primarily for use in the ASCONF-ACK chunk.
*
* Value Cause Code
* --------- ----------------
* 0x0100 Request to Delete Last Remaining IP Address.
* 0x0101 Operation Refused Due to Resource Shortage.
* 0x0102 Request to Delete Source IP Address.
* 0x0103 Association Aborted due to illegal ASCONF-ACK
* 0x0104 Request refused - no authorization.
*/
SCTP_ERROR_DEL_LAST_IP = __constant_htons(0x0100),
SCTP_ERROR_RSRC_LOW = __constant_htons(0x0101),
SCTP_ERROR_DEL_SRC_IP = __constant_htons(0x0102),
SCTP_ERROR_ASCONF_ACK = __constant_htons(0x0103),
SCTP_ERROR_REQ_REFUSED = __constant_htons(0x0104)
} sctp_error_t;
/* RFC 2960. Appendix A. Explicit Congestion Notification.
* Explicit Congestion Notification Echo (ECNE) (12)
*/
typedef struct sctp_ecnehdr {
__u32 lowest_tsn;
} sctp_ecnehdr_t;
typedef struct sctp_ecne_chunk {
sctp_chunkhdr_t chunk_hdr;
sctp_ecnehdr_t ence_hdr;
} __attribute__((packed)) sctp_ecne_chunk_t;
/* RFC 2960. Appendix A. Explicit Congestion Notification.
* Congestion Window Reduced (CWR) (13)
*/
typedef struct sctp_cwrhdr {
__u32 lowest_tsn;
} sctp_cwrhdr_t;
typedef struct sctp_cwr_chunk {
sctp_chunkhdr_t chunk_hdr;
sctp_cwrhdr_t cwr_hdr;
} __attribute__((packed)) sctp_cwr_chunk_t;
/* PR-SCTP
* 3.2 Forward Cumulative TSN Chunk Definition (FORWARD TSN)
*
* Forward Cumulative TSN chunk has the following format:
*
* 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 = 192 | Flags = 0x00 | Length = Variable |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | New Cumulative TSN |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Stream-1 | Stream Sequence-1 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* \ /
* / \
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Stream-N | Stream Sequence-N |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* Chunk Flags:
*
* Set to all zeros on transmit and ignored on receipt.
*
* New Cumulative TSN: 32 bit u_int
*
* This indicates the new cumulative TSN to the data receiver. Upon
* the reception of this value, the data receiver MUST consider
* any missing TSNs earlier than or equal to this value as received
* and stop reporting them as gaps in any subsequent SACKs.
*
* Stream-N: 16 bit u_int
*
* This field holds a stream number that was skipped by this
* FWD-TSN.
*
* Stream Sequence-N: 16 bit u_int
* This field holds the sequence number associated with the stream
* that was skipped. The stream sequence field holds the largest stream
* sequence number in this stream being skipped. The receiver of
* the FWD-TSN's can use the Stream-N and Stream Sequence-N fields
* to enable delivery of any stranded TSN's that remain on the stream
* re-ordering queues. This field MUST NOT report TSN's corresponding
* to DATA chunk that are marked as unordered. For ordered DATA
* chunks this field MUST be filled in.
*/
struct sctp_fwdtsn_skip {
__u16 stream;
__u16 ssn;
} __attribute__((packed));
struct sctp_fwdtsn_hdr {
__u32 new_cum_tsn;
struct sctp_fwdtsn_skip skip[0];
} __attribute((packed));
struct sctp_fwdtsn_chunk {
struct sctp_chunkhdr chunk_hdr;
struct sctp_fwdtsn_hdr fwdtsn_hdr;
} __attribute((packed));
/* ADDIP
* Section 3.1.1 Address Configuration Change Chunk (ASCONF)
*
* Serial Number: 32 bits (unsigned integer)
* This value represents a Serial Number for the ASCONF Chunk. The
* valid range of Serial Number is from 0 to 2^32-1.
* Serial Numbers wrap back to 0 after reaching 2^32 -1.
*
* Address Parameter: 8 or 20 bytes (depending on type)
* The address is an address of the sender of the ASCONF chunk,
* the address MUST be considered part of the association by the
* peer endpoint. This field may be used by the receiver of the
* ASCONF to help in finding the association. This parameter MUST
* be present in every ASCONF message i.e. it is a mandatory TLV
* parameter.
*
* ASCONF Parameter: TLV format
* Each Address configuration change is represented by a TLV
* parameter as defined in Section 3.2. One or more requests may
* be present in an ASCONF Chunk.
*
* Section 3.1.2 Address Configuration Acknowledgement Chunk (ASCONF-ACK)
*
* Serial Number: 32 bits (unsigned integer)
* This value represents the Serial Number for the received ASCONF
* Chunk that is acknowledged by this chunk. This value is copied
* from the received ASCONF Chunk.
*
* ASCONF Parameter Response: TLV format
* The ASCONF Parameter Response is used in the ASCONF-ACK to
* report status of ASCONF processing.
*/
typedef struct sctp_addip_param {
sctp_paramhdr_t param_hdr;
__u32 crr_id;
} __attribute__((packed)) sctp_addip_param_t;
typedef struct sctp_addiphdr {
__u32 serial;
__u8 params[0];
} __attribute__((packed)) sctp_addiphdr_t;
typedef struct sctp_addip_chunk {
sctp_chunkhdr_t chunk_hdr;
sctp_addiphdr_t addip_hdr;
} __attribute__((packed)) sctp_addip_chunk_t;
#endif /* __LINUX_SCTP_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -