dccp.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. #ifndef _LINUX_DCCP_H
  2. #define _LINUX_DCCP_H
  3. #include <linux/types.h>
  4. #include <asm/byteorder.h>
  5. /**
  6. * struct dccp_hdr - generic part of DCCP packet header
  7. *
  8. * @dccph_sport - Relevant port on the endpoint that sent this packet
  9. * @dccph_dport - Relevant port on the other endpoint
  10. * @dccph_doff - Data Offset from the start of the DCCP header, in 32-bit words
  11. * @dccph_ccval - Used by the HC-Sender CCID
  12. * @dccph_cscov - Parts of the packet that are covered by the Checksum field
  13. * @dccph_checksum - Internet checksum, depends on dccph_cscov
  14. * @dccph_x - 0 = 24 bit sequence number, 1 = 48
  15. * @dccph_type - packet type, see DCCP_PKT_ prefixed macros
  16. * @dccph_seq - sequence number high or low order 24 bits, depends on dccph_x
  17. */
  18. struct dccp_hdr {
  19. __be16 dccph_sport,
  20. dccph_dport;
  21. __u8 dccph_doff;
  22. #if defined(__LITTLE_ENDIAN_BITFIELD)
  23. __u8 dccph_cscov:4,
  24. dccph_ccval:4;
  25. #elif defined(__BIG_ENDIAN_BITFIELD)
  26. __u8 dccph_ccval:4,
  27. dccph_cscov:4;
  28. #else
  29. #error "Adjust your <asm/byteorder.h> defines"
  30. #endif
  31. __sum16 dccph_checksum;
  32. #if defined(__LITTLE_ENDIAN_BITFIELD)
  33. __u8 dccph_x:1,
  34. dccph_type:4,
  35. dccph_reserved:3;
  36. #elif defined(__BIG_ENDIAN_BITFIELD)
  37. __u8 dccph_reserved:3,
  38. dccph_type:4,
  39. dccph_x:1;
  40. #else
  41. #error "Adjust your <asm/byteorder.h> defines"
  42. #endif
  43. __u8 dccph_seq2;
  44. __be16 dccph_seq;
  45. };
  46. /**
  47. * struct dccp_hdr_ext - the low bits of a 48 bit seq packet
  48. *
  49. * @dccph_seq_low - low 24 bits of a 48 bit seq packet
  50. */
  51. struct dccp_hdr_ext {
  52. __be32 dccph_seq_low;
  53. };
  54. /**
  55. * struct dccp_hdr_request - Connection initiation request header
  56. *
  57. * @dccph_req_service - Service to which the client app wants to connect
  58. */
  59. struct dccp_hdr_request {
  60. __be32 dccph_req_service;
  61. };
  62. /**
  63. * struct dccp_hdr_ack_bits - acknowledgment bits common to most packets
  64. *
  65. * @dccph_resp_ack_nr_high - 48 bit ack number high order bits, contains GSR
  66. * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR
  67. */
  68. struct dccp_hdr_ack_bits {
  69. __be16 dccph_reserved1;
  70. __be16 dccph_ack_nr_high;
  71. __be32 dccph_ack_nr_low;
  72. };
  73. /**
  74. * struct dccp_hdr_response - Connection initiation response header
  75. *
  76. * @dccph_resp_ack - 48 bit Acknowledgment Number Subheader (5.3)
  77. * @dccph_resp_service - Echoes the Service Code on a received DCCP-Request
  78. */
  79. struct dccp_hdr_response {
  80. struct dccp_hdr_ack_bits dccph_resp_ack;
  81. __be32 dccph_resp_service;
  82. };
  83. /**
  84. * struct dccp_hdr_reset - Unconditionally shut down a connection
  85. *
  86. * @dccph_reset_ack - 48 bit Acknowledgment Number Subheader (5.6)
  87. * @dccph_reset_code - one of %dccp_reset_codes
  88. * @dccph_reset_data - the Data 1 ... Data 3 fields from 5.6
  89. */
  90. struct dccp_hdr_reset {
  91. struct dccp_hdr_ack_bits dccph_reset_ack;
  92. __u8 dccph_reset_code,
  93. dccph_reset_data[3];
  94. };
  95. enum dccp_pkt_type {
  96. DCCP_PKT_REQUEST = 0,
  97. DCCP_PKT_RESPONSE,
  98. DCCP_PKT_DATA,
  99. DCCP_PKT_ACK,
  100. DCCP_PKT_DATAACK,
  101. DCCP_PKT_CLOSEREQ,
  102. DCCP_PKT_CLOSE,
  103. DCCP_PKT_RESET,
  104. DCCP_PKT_SYNC,
  105. DCCP_PKT_SYNCACK,
  106. DCCP_PKT_INVALID,
  107. };
  108. #define DCCP_NR_PKT_TYPES DCCP_PKT_INVALID
  109. static inline unsigned int dccp_packet_hdr_len(const __u8 type)
  110. {
  111. if (type == DCCP_PKT_DATA)
  112. return 0;
  113. if (type == DCCP_PKT_DATAACK ||
  114. type == DCCP_PKT_ACK ||
  115. type == DCCP_PKT_SYNC ||
  116. type == DCCP_PKT_SYNCACK ||
  117. type == DCCP_PKT_CLOSE ||
  118. type == DCCP_PKT_CLOSEREQ)
  119. return sizeof(struct dccp_hdr_ack_bits);
  120. if (type == DCCP_PKT_REQUEST)
  121. return sizeof(struct dccp_hdr_request);
  122. if (type == DCCP_PKT_RESPONSE)
  123. return sizeof(struct dccp_hdr_response);
  124. return sizeof(struct dccp_hdr_reset);
  125. }
  126. enum dccp_reset_codes {
  127. DCCP_RESET_CODE_UNSPECIFIED = 0,
  128. DCCP_RESET_CODE_CLOSED,
  129. DCCP_RESET_CODE_ABORTED,
  130. DCCP_RESET_CODE_NO_CONNECTION,
  131. DCCP_RESET_CODE_PACKET_ERROR,
  132. DCCP_RESET_CODE_OPTION_ERROR,
  133. DCCP_RESET_CODE_MANDATORY_ERROR,
  134. DCCP_RESET_CODE_CONNECTION_REFUSED,
  135. DCCP_RESET_CODE_BAD_SERVICE_CODE,
  136. DCCP_RESET_CODE_TOO_BUSY,
  137. DCCP_RESET_CODE_BAD_INIT_COOKIE,
  138. DCCP_RESET_CODE_AGGRESSION_PENALTY,
  139. DCCP_MAX_RESET_CODES /* Leave at the end! */
  140. };
  141. /* DCCP options */
  142. enum {
  143. DCCPO_PADDING = 0,
  144. DCCPO_MANDATORY = 1,
  145. DCCPO_MIN_RESERVED = 3,
  146. DCCPO_MAX_RESERVED = 31,
  147. DCCPO_CHANGE_L = 32,
  148. DCCPO_CONFIRM_L = 33,
  149. DCCPO_CHANGE_R = 34,
  150. DCCPO_CONFIRM_R = 35,
  151. DCCPO_NDP_COUNT = 37,
  152. DCCPO_ACK_VECTOR_0 = 38,
  153. DCCPO_ACK_VECTOR_1 = 39,
  154. DCCPO_TIMESTAMP = 41,
  155. DCCPO_TIMESTAMP_ECHO = 42,
  156. DCCPO_ELAPSED_TIME = 43,
  157. DCCPO_MAX = 45,
  158. DCCPO_MIN_RX_CCID_SPECIFIC = 128, /* from sender to receiver */
  159. DCCPO_MAX_RX_CCID_SPECIFIC = 191,
  160. DCCPO_MIN_TX_CCID_SPECIFIC = 192, /* from receiver to sender */
  161. DCCPO_MAX_TX_CCID_SPECIFIC = 255,
  162. };
  163. /* maximum size of a single TLV-encoded DCCP option (sans type/len bytes) */
  164. #define DCCP_SINGLE_OPT_MAXLEN 253
  165. /* DCCP CCIDS */
  166. enum {
  167. DCCPC_CCID2 = 2,
  168. DCCPC_CCID3 = 3,
  169. };
  170. /* DCCP features (RFC 4340 section 6.4) */
  171. enum dccp_feature_numbers {
  172. DCCPF_RESERVED = 0,
  173. DCCPF_CCID = 1,
  174. DCCPF_SHORT_SEQNOS = 2,
  175. DCCPF_SEQUENCE_WINDOW = 3,
  176. DCCPF_ECN_INCAPABLE = 4,
  177. DCCPF_ACK_RATIO = 5,
  178. DCCPF_SEND_ACK_VECTOR = 6,
  179. DCCPF_SEND_NDP_COUNT = 7,
  180. DCCPF_MIN_CSUM_COVER = 8,
  181. DCCPF_DATA_CHECKSUM = 9,
  182. /* 10-127 reserved */
  183. DCCPF_MIN_CCID_SPECIFIC = 128,
  184. DCCPF_SEND_LEV_RATE = 192, /* RFC 4342, sec. 8.4 */
  185. DCCPF_MAX_CCID_SPECIFIC = 255,
  186. };
  187. /* DCCP socket control message types for cmsg */
  188. enum dccp_cmsg_type {
  189. DCCP_SCM_PRIORITY = 1,
  190. DCCP_SCM_QPOLICY_MAX = 0xFFFF,
  191. /* ^-- Up to here reserved exclusively for qpolicy parameters */
  192. DCCP_SCM_MAX
  193. };
  194. /* DCCP priorities for outgoing/queued packets */
  195. enum dccp_packet_dequeueing_policy {
  196. DCCPQ_POLICY_SIMPLE,
  197. DCCPQ_POLICY_PRIO,
  198. DCCPQ_POLICY_MAX
  199. };
  200. /* DCCP socket options */
  201. #define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */
  202. #define DCCP_SOCKOPT_SERVICE 2
  203. #define DCCP_SOCKOPT_CHANGE_L 3
  204. #define DCCP_SOCKOPT_CHANGE_R 4
  205. #define DCCP_SOCKOPT_GET_CUR_MPS 5
  206. #define DCCP_SOCKOPT_SERVER_TIMEWAIT 6
  207. #define DCCP_SOCKOPT_SEND_CSCOV 10
  208. #define DCCP_SOCKOPT_RECV_CSCOV 11
  209. #define DCCP_SOCKOPT_AVAILABLE_CCIDS 12
  210. #define DCCP_SOCKOPT_CCID 13
  211. #define DCCP_SOCKOPT_TX_CCID 14
  212. #define DCCP_SOCKOPT_RX_CCID 15
  213. #define DCCP_SOCKOPT_QPOLICY_ID 16
  214. #define DCCP_SOCKOPT_QPOLICY_TXQLEN 17
  215. #define DCCP_SOCKOPT_CCID_RX_INFO 128
  216. #define DCCP_SOCKOPT_CCID_TX_INFO 192
  217. /* maximum number of services provided on the same listening port */
  218. #define DCCP_SERVICE_LIST_MAX_LEN 32
  219. #ifdef __KERNEL__
  220. #include <linux/in.h>
  221. #include <linux/interrupt.h>
  222. #include <linux/ktime.h>
  223. #include <linux/list.h>
  224. #include <linux/uio.h>
  225. #include <linux/workqueue.h>
  226. #include <net/inet_connection_sock.h>
  227. #include <net/inet_sock.h>
  228. #include <net/inet_timewait_sock.h>
  229. #include <net/tcp_states.h>
  230. enum dccp_state {
  231. DCCP_OPEN = TCP_ESTABLISHED,
  232. DCCP_REQUESTING = TCP_SYN_SENT,
  233. DCCP_LISTEN = TCP_LISTEN,
  234. DCCP_RESPOND = TCP_SYN_RECV,
  235. /*
  236. * States involved in closing a DCCP connection:
  237. * 1) ACTIVE_CLOSEREQ is entered by a server sending a CloseReq.
  238. *
  239. * 2) CLOSING can have three different meanings (RFC 4340, 8.3):
  240. * a. Client has performed active-close, has sent a Close to the server
  241. * from state OPEN or PARTOPEN, and is waiting for the final Reset
  242. * (in this case, SOCK_DONE == 1).
  243. * b. Client is asked to perform passive-close, by receiving a CloseReq
  244. * in (PART)OPEN state. It sends a Close and waits for final Reset
  245. * (in this case, SOCK_DONE == 0).
  246. * c. Server performs an active-close as in (a), keeps TIMEWAIT state.
  247. *
  248. * 3) The following intermediate states are employed to give passively
  249. * closing nodes a chance to process their unread data:
  250. * - PASSIVE_CLOSE (from OPEN => CLOSED) and
  251. * - PASSIVE_CLOSEREQ (from (PART)OPEN to CLOSING; case (b) above).
  252. */
  253. DCCP_ACTIVE_CLOSEREQ = TCP_FIN_WAIT1,
  254. DCCP_PASSIVE_CLOSE = TCP_CLOSE_WAIT, /* any node receiving a Close */
  255. DCCP_CLOSING = TCP_CLOSING,
  256. DCCP_TIME_WAIT = TCP_TIME_WAIT,
  257. DCCP_CLOSED = TCP_CLOSE,
  258. DCCP_PARTOPEN = TCP_MAX_STATES,
  259. DCCP_PASSIVE_CLOSEREQ, /* clients receiving CloseReq */
  260. DCCP_MAX_STATES
  261. };
  262. enum {
  263. DCCPF_OPEN = TCPF_ESTABLISHED,
  264. DCCPF_REQUESTING = TCPF_SYN_SENT,
  265. DCCPF_LISTEN = TCPF_LISTEN,
  266. DCCPF_RESPOND = TCPF_SYN_RECV,
  267. DCCPF_ACTIVE_CLOSEREQ = TCPF_FIN_WAIT1,
  268. DCCPF_CLOSING = TCPF_CLOSING,
  269. DCCPF_TIME_WAIT = TCPF_TIME_WAIT,
  270. DCCPF_CLOSED = TCPF_CLOSE,
  271. DCCPF_PARTOPEN = (1 << DCCP_PARTOPEN),
  272. };
  273. static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb)
  274. {
  275. return (struct dccp_hdr *)skb_transport_header(skb);
  276. }
  277. static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen)
  278. {
  279. skb_push(skb, headlen);
  280. skb_reset_transport_header(skb);
  281. return memset(skb_transport_header(skb), 0, headlen);
  282. }
  283. static inline struct dccp_hdr_ext *dccp_hdrx(const struct dccp_hdr *dh)
  284. {
  285. return (struct dccp_hdr_ext *)((unsigned char *)dh + sizeof(*dh));
  286. }
  287. static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh)
  288. {
  289. return sizeof(*dh) + (dh->dccph_x ? sizeof(struct dccp_hdr_ext) : 0);
  290. }
  291. static inline unsigned int dccp_basic_hdr_len(const struct sk_buff *skb)
  292. {
  293. const struct dccp_hdr *dh = dccp_hdr(skb);
  294. return __dccp_basic_hdr_len(dh);
  295. }
  296. static inline __u64 dccp_hdr_seq(const struct dccp_hdr *dh)
  297. {
  298. __u64 seq_nr = ntohs(dh->dccph_seq);
  299. if (dh->dccph_x != 0)
  300. seq_nr = (seq_nr << 32) + ntohl(dccp_hdrx(dh)->dccph_seq_low);
  301. else
  302. seq_nr += (u32)dh->dccph_seq2 << 16;
  303. return seq_nr;
  304. }
  305. static inline struct dccp_hdr_request *dccp_hdr_request(struct sk_buff *skb)
  306. {
  307. return (struct dccp_hdr_request *)(skb_transport_header(skb) +
  308. dccp_basic_hdr_len(skb));
  309. }
  310. static inline struct dccp_hdr_ack_bits *dccp_hdr_ack_bits(const struct sk_buff *skb)
  311. {
  312. return (struct dccp_hdr_ack_bits *)(skb_transport_header(skb) +
  313. dccp_basic_hdr_len(skb));
  314. }
  315. static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb)
  316. {
  317. const struct dccp_hdr_ack_bits *dhack = dccp_hdr_ack_bits(skb);
  318. return ((u64)ntohs(dhack->dccph_ack_nr_high) << 32) + ntohl(dhack->dccph_ack_nr_low);
  319. }
  320. static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb)
  321. {
  322. return (struct dccp_hdr_response *)(skb_transport_header(skb) +
  323. dccp_basic_hdr_len(skb));
  324. }
  325. static inline struct dccp_hdr_reset *dccp_hdr_reset(struct sk_buff *skb)
  326. {
  327. return (struct dccp_hdr_reset *)(skb_transport_header(skb) +
  328. dccp_basic_hdr_len(skb));
  329. }
  330. static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh)
  331. {
  332. return __dccp_basic_hdr_len(dh) +
  333. dccp_packet_hdr_len(dh->dccph_type);
  334. }
  335. static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
  336. {
  337. return __dccp_hdr_len(dccp_hdr(skb));
  338. }
  339. /**
  340. * struct dccp_request_sock - represent DCCP-specific connection request
  341. * @dreq_inet_rsk: structure inherited from
  342. * @dreq_iss: initial sequence number, sent on the first Response (RFC 4340, 7.1)
  343. * @dreq_gss: greatest sequence number sent (for retransmitted Responses)
  344. * @dreq_isr: initial sequence number received in the first Request
  345. * @dreq_gsr: greatest sequence number received (for retransmitted Request(s))
  346. * @dreq_service: service code present on the Request (there is just one)
  347. * @dreq_featneg: feature negotiation options for this connection
  348. * The following two fields are analogous to the ones in dccp_sock:
  349. * @dreq_timestamp_echo: last received timestamp to echo (13.1)
  350. * @dreq_timestamp_echo: the time of receiving the last @dreq_timestamp_echo
  351. */
  352. struct dccp_request_sock {
  353. struct inet_request_sock dreq_inet_rsk;
  354. __u64 dreq_iss;
  355. __u64 dreq_gss;
  356. __u64 dreq_isr;
  357. __u64 dreq_gsr;
  358. __be32 dreq_service;
  359. struct list_head dreq_featneg;
  360. __u32 dreq_timestamp_echo;
  361. __u32 dreq_timestamp_time;
  362. };
  363. static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req)
  364. {
  365. return (struct dccp_request_sock *)req;
  366. }
  367. extern struct inet_timewait_death_row dccp_death_row;
  368. extern int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq,
  369. struct sk_buff *skb);
  370. struct dccp_options_received {
  371. u64 dccpor_ndp:48;
  372. u32 dccpor_timestamp;
  373. u32 dccpor_timestamp_echo;
  374. u32 dccpor_elapsed_time;
  375. };
  376. struct ccid;
  377. enum dccp_role {
  378. DCCP_ROLE_UNDEFINED,
  379. DCCP_ROLE_LISTEN,
  380. DCCP_ROLE_CLIENT,
  381. DCCP_ROLE_SERVER,
  382. };
  383. struct dccp_service_list {
  384. __u32 dccpsl_nr;
  385. __be32 dccpsl_list[0];
  386. };
  387. #define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1)
  388. #define DCCP_SERVICE_CODE_IS_ABSENT 0
  389. static inline int dccp_list_has_service(const struct dccp_service_list *sl,
  390. const __be32 service)
  391. {
  392. if (likely(sl != NULL)) {
  393. u32 i = sl->dccpsl_nr;
  394. while (i--)
  395. if (sl->dccpsl_list[i] == service)
  396. return 1;
  397. }
  398. return 0;
  399. }
  400. struct dccp_ackvec;
  401. /**
  402. * struct dccp_sock - DCCP socket state
  403. *
  404. * @dccps_swl - sequence number window low
  405. * @dccps_swh - sequence number window high
  406. * @dccps_awl - acknowledgement number window low
  407. * @dccps_awh - acknowledgement number window high
  408. * @dccps_iss - initial sequence number sent
  409. * @dccps_isr - initial sequence number received
  410. * @dccps_osr - first OPEN sequence number received
  411. * @dccps_gss - greatest sequence number sent
  412. * @dccps_gsr - greatest valid sequence number received
  413. * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss
  414. * @dccps_service - first (passive sock) or unique (active sock) service code
  415. * @dccps_service_list - second .. last service code on passive socket
  416. * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
  417. * @dccps_timestamp_time - time of receiving latest @dccps_timestamp_echo
  418. * @dccps_l_ack_ratio - feature-local Ack Ratio
  419. * @dccps_r_ack_ratio - feature-remote Ack Ratio
  420. * @dccps_l_seq_win - local Sequence Window (influences ack number validity)
  421. * @dccps_r_seq_win - remote Sequence Window (influences seq number validity)
  422. * @dccps_pcslen - sender partial checksum coverage (via sockopt)
  423. * @dccps_pcrlen - receiver partial checksum coverage (via sockopt)
  424. * @dccps_send_ndp_count - local Send NDP Count feature (7.7.2)
  425. * @dccps_ndp_count - number of Non Data Packets since last data packet
  426. * @dccps_mss_cache - current value of MSS (path MTU minus header sizes)
  427. * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4)
  428. * @dccps_featneg - tracks feature-negotiation state (mostly during handshake)
  429. * @dccps_hc_rx_ackvec - rx half connection ack vector
  430. * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection)
  431. * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection)
  432. * @dccps_options_received - parsed set of retrieved options
  433. * @dccps_qpolicy - TX dequeueing policy, one of %dccp_packet_dequeueing_policy
  434. * @dccps_tx_qlen - maximum length of the TX queue
  435. * @dccps_role - role of this sock, one of %dccp_role
  436. * @dccps_hc_rx_insert_options - receiver wants to add options when acking
  437. * @dccps_hc_tx_insert_options - sender wants to add options when sending
  438. * @dccps_server_timewait - server holds timewait state on close (RFC 4340, 8.3)
  439. * @dccps_sync_scheduled - flag which signals "send out-of-band message soon"
  440. * @dccps_xmitlet - tasklet scheduled by the TX CCID to dequeue data packets
  441. * @dccps_xmit_timer - used by the TX CCID to delay sending (rate-based pacing)
  442. * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs)
  443. */
  444. struct dccp_sock {
  445. /* inet_connection_sock has to be the first member of dccp_sock */
  446. struct inet_connection_sock dccps_inet_connection;
  447. #define dccps_syn_rtt dccps_inet_connection.icsk_ack.lrcvtime
  448. __u64 dccps_swl;
  449. __u64 dccps_swh;
  450. __u64 dccps_awl;
  451. __u64 dccps_awh;
  452. __u64 dccps_iss;
  453. __u64 dccps_isr;
  454. __u64 dccps_osr;
  455. __u64 dccps_gss;
  456. __u64 dccps_gsr;
  457. __u64 dccps_gar;
  458. __be32 dccps_service;
  459. __u32 dccps_mss_cache;
  460. struct dccp_service_list *dccps_service_list;
  461. __u32 dccps_timestamp_echo;
  462. __u32 dccps_timestamp_time;
  463. __u16 dccps_l_ack_ratio;
  464. __u16 dccps_r_ack_ratio;
  465. __u64 dccps_l_seq_win:48;
  466. __u64 dccps_r_seq_win:48;
  467. __u8 dccps_pcslen:4;
  468. __u8 dccps_pcrlen:4;
  469. __u8 dccps_send_ndp_count:1;
  470. __u64 dccps_ndp_count:48;
  471. unsigned long dccps_rate_last;
  472. struct list_head dccps_featneg;
  473. struct dccp_ackvec *dccps_hc_rx_ackvec;
  474. struct ccid *dccps_hc_rx_ccid;
  475. struct ccid *dccps_hc_tx_ccid;
  476. struct dccp_options_received dccps_options_received;
  477. __u8 dccps_qpolicy;
  478. __u32 dccps_tx_qlen;
  479. enum dccp_role dccps_role:2;
  480. __u8 dccps_hc_rx_insert_options:1;
  481. __u8 dccps_hc_tx_insert_options:1;
  482. __u8 dccps_server_timewait:1;
  483. __u8 dccps_sync_scheduled:1;
  484. struct tasklet_struct dccps_xmitlet;
  485. struct timer_list dccps_xmit_timer;
  486. };
  487. static inline struct dccp_sock *dccp_sk(const struct sock *sk)
  488. {
  489. return (struct dccp_sock *)sk;
  490. }
  491. static inline const char *dccp_role(const struct sock *sk)
  492. {
  493. switch (dccp_sk(sk)->dccps_role) {
  494. case DCCP_ROLE_UNDEFINED: return "undefined";
  495. case DCCP_ROLE_LISTEN: return "listen";
  496. case DCCP_ROLE_SERVER: return "server";
  497. case DCCP_ROLE_CLIENT: return "client";
  498. }
  499. return NULL;
  500. }
  501. #endif /* __KERNEL__ */
  502. #endif /* _LINUX_DCCP_H */