0001
0002 #ifndef _UAPI_LINUX_DCCP_H
0003 #define _UAPI_LINUX_DCCP_H
0004
0005 #include <linux/types.h>
0006 #include <asm/byteorder.h>
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 struct dccp_hdr {
0022 __be16 dccph_sport,
0023 dccph_dport;
0024 __u8 dccph_doff;
0025 #if defined(__LITTLE_ENDIAN_BITFIELD)
0026 __u8 dccph_cscov:4,
0027 dccph_ccval:4;
0028 #elif defined(__BIG_ENDIAN_BITFIELD)
0029 __u8 dccph_ccval:4,
0030 dccph_cscov:4;
0031 #else
0032 #error "Adjust your <asm/byteorder.h> defines"
0033 #endif
0034 __sum16 dccph_checksum;
0035 #if defined(__LITTLE_ENDIAN_BITFIELD)
0036 __u8 dccph_x:1,
0037 dccph_type:4,
0038 dccph_reserved:3;
0039 #elif defined(__BIG_ENDIAN_BITFIELD)
0040 __u8 dccph_reserved:3,
0041 dccph_type:4,
0042 dccph_x:1;
0043 #else
0044 #error "Adjust your <asm/byteorder.h> defines"
0045 #endif
0046 __u8 dccph_seq2;
0047 __be16 dccph_seq;
0048 };
0049
0050
0051
0052
0053
0054
0055 struct dccp_hdr_ext {
0056 __be32 dccph_seq_low;
0057 };
0058
0059
0060
0061
0062
0063
0064 struct dccp_hdr_request {
0065 __be32 dccph_req_service;
0066 };
0067
0068
0069
0070
0071
0072
0073 struct dccp_hdr_ack_bits {
0074 __be16 dccph_reserved1;
0075 __be16 dccph_ack_nr_high;
0076 __be32 dccph_ack_nr_low;
0077 };
0078
0079
0080
0081
0082
0083
0084 struct dccp_hdr_response {
0085 struct dccp_hdr_ack_bits dccph_resp_ack;
0086 __be32 dccph_resp_service;
0087 };
0088
0089
0090
0091
0092
0093
0094
0095
0096 struct dccp_hdr_reset {
0097 struct dccp_hdr_ack_bits dccph_reset_ack;
0098 __u8 dccph_reset_code,
0099 dccph_reset_data[3];
0100 };
0101
0102 enum dccp_pkt_type {
0103 DCCP_PKT_REQUEST = 0,
0104 DCCP_PKT_RESPONSE,
0105 DCCP_PKT_DATA,
0106 DCCP_PKT_ACK,
0107 DCCP_PKT_DATAACK,
0108 DCCP_PKT_CLOSEREQ,
0109 DCCP_PKT_CLOSE,
0110 DCCP_PKT_RESET,
0111 DCCP_PKT_SYNC,
0112 DCCP_PKT_SYNCACK,
0113 DCCP_PKT_INVALID,
0114 };
0115
0116 #define DCCP_NR_PKT_TYPES DCCP_PKT_INVALID
0117
0118 static inline unsigned int dccp_packet_hdr_len(const __u8 type)
0119 {
0120 if (type == DCCP_PKT_DATA)
0121 return 0;
0122 if (type == DCCP_PKT_DATAACK ||
0123 type == DCCP_PKT_ACK ||
0124 type == DCCP_PKT_SYNC ||
0125 type == DCCP_PKT_SYNCACK ||
0126 type == DCCP_PKT_CLOSE ||
0127 type == DCCP_PKT_CLOSEREQ)
0128 return sizeof(struct dccp_hdr_ack_bits);
0129 if (type == DCCP_PKT_REQUEST)
0130 return sizeof(struct dccp_hdr_request);
0131 if (type == DCCP_PKT_RESPONSE)
0132 return sizeof(struct dccp_hdr_response);
0133 return sizeof(struct dccp_hdr_reset);
0134 }
0135 enum dccp_reset_codes {
0136 DCCP_RESET_CODE_UNSPECIFIED = 0,
0137 DCCP_RESET_CODE_CLOSED,
0138 DCCP_RESET_CODE_ABORTED,
0139 DCCP_RESET_CODE_NO_CONNECTION,
0140 DCCP_RESET_CODE_PACKET_ERROR,
0141 DCCP_RESET_CODE_OPTION_ERROR,
0142 DCCP_RESET_CODE_MANDATORY_ERROR,
0143 DCCP_RESET_CODE_CONNECTION_REFUSED,
0144 DCCP_RESET_CODE_BAD_SERVICE_CODE,
0145 DCCP_RESET_CODE_TOO_BUSY,
0146 DCCP_RESET_CODE_BAD_INIT_COOKIE,
0147 DCCP_RESET_CODE_AGGRESSION_PENALTY,
0148
0149 DCCP_MAX_RESET_CODES
0150 };
0151
0152
0153 enum {
0154 DCCPO_PADDING = 0,
0155 DCCPO_MANDATORY = 1,
0156 DCCPO_MIN_RESERVED = 3,
0157 DCCPO_MAX_RESERVED = 31,
0158 DCCPO_CHANGE_L = 32,
0159 DCCPO_CONFIRM_L = 33,
0160 DCCPO_CHANGE_R = 34,
0161 DCCPO_CONFIRM_R = 35,
0162 DCCPO_NDP_COUNT = 37,
0163 DCCPO_ACK_VECTOR_0 = 38,
0164 DCCPO_ACK_VECTOR_1 = 39,
0165 DCCPO_TIMESTAMP = 41,
0166 DCCPO_TIMESTAMP_ECHO = 42,
0167 DCCPO_ELAPSED_TIME = 43,
0168 DCCPO_MAX = 45,
0169 DCCPO_MIN_RX_CCID_SPECIFIC = 128,
0170 DCCPO_MAX_RX_CCID_SPECIFIC = 191,
0171 DCCPO_MIN_TX_CCID_SPECIFIC = 192,
0172 DCCPO_MAX_TX_CCID_SPECIFIC = 255,
0173 };
0174
0175 #define DCCP_SINGLE_OPT_MAXLEN 253
0176
0177
0178 enum {
0179 DCCPC_CCID2 = 2,
0180 DCCPC_CCID3 = 3,
0181 };
0182
0183
0184 enum dccp_feature_numbers {
0185 DCCPF_RESERVED = 0,
0186 DCCPF_CCID = 1,
0187 DCCPF_SHORT_SEQNOS = 2,
0188 DCCPF_SEQUENCE_WINDOW = 3,
0189 DCCPF_ECN_INCAPABLE = 4,
0190 DCCPF_ACK_RATIO = 5,
0191 DCCPF_SEND_ACK_VECTOR = 6,
0192 DCCPF_SEND_NDP_COUNT = 7,
0193 DCCPF_MIN_CSUM_COVER = 8,
0194 DCCPF_DATA_CHECKSUM = 9,
0195
0196 DCCPF_MIN_CCID_SPECIFIC = 128,
0197 DCCPF_SEND_LEV_RATE = 192,
0198 DCCPF_MAX_CCID_SPECIFIC = 255,
0199 };
0200
0201
0202 enum dccp_cmsg_type {
0203 DCCP_SCM_PRIORITY = 1,
0204 DCCP_SCM_QPOLICY_MAX = 0xFFFF,
0205
0206 DCCP_SCM_MAX
0207 };
0208
0209
0210 enum dccp_packet_dequeueing_policy {
0211 DCCPQ_POLICY_SIMPLE,
0212 DCCPQ_POLICY_PRIO,
0213 DCCPQ_POLICY_MAX
0214 };
0215
0216
0217 #define DCCP_SOCKOPT_PACKET_SIZE 1
0218 #define DCCP_SOCKOPT_SERVICE 2
0219 #define DCCP_SOCKOPT_CHANGE_L 3
0220 #define DCCP_SOCKOPT_CHANGE_R 4
0221 #define DCCP_SOCKOPT_GET_CUR_MPS 5
0222 #define DCCP_SOCKOPT_SERVER_TIMEWAIT 6
0223 #define DCCP_SOCKOPT_SEND_CSCOV 10
0224 #define DCCP_SOCKOPT_RECV_CSCOV 11
0225 #define DCCP_SOCKOPT_AVAILABLE_CCIDS 12
0226 #define DCCP_SOCKOPT_CCID 13
0227 #define DCCP_SOCKOPT_TX_CCID 14
0228 #define DCCP_SOCKOPT_RX_CCID 15
0229 #define DCCP_SOCKOPT_QPOLICY_ID 16
0230 #define DCCP_SOCKOPT_QPOLICY_TXQLEN 17
0231 #define DCCP_SOCKOPT_CCID_RX_INFO 128
0232 #define DCCP_SOCKOPT_CCID_TX_INFO 192
0233
0234
0235 #define DCCP_SERVICE_LIST_MAX_LEN 32
0236
0237
0238 #endif