diff options
Diffstat (limited to 'include/linux/dccp.h')
-rw-r--r-- | include/linux/dccp.h | 59 |
1 files changed, 38 insertions, 21 deletions
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 8bf4bacb5051..71fab4311e92 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
@@ -4,16 +4,6 @@ | |||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <asm/byteorder.h> | 5 | #include <asm/byteorder.h> |
6 | 6 | ||
7 | /* Structure describing an Internet (DCCP) socket address. */ | ||
8 | struct sockaddr_dccp { | ||
9 | __u16 sdccp_family; /* Address family */ | ||
10 | __u16 sdccp_port; /* Port number */ | ||
11 | __u32 sdccp_addr; /* Internet address */ | ||
12 | __u32 sdccp_service; /* Service */ | ||
13 | /* Pad to size of `struct sockaddr': 16 bytes . */ | ||
14 | __u32 sdccp_pad; | ||
15 | }; | ||
16 | |||
17 | /** | 7 | /** |
18 | * struct dccp_hdr - generic part of DCCP packet header | 8 | * struct dccp_hdr - generic part of DCCP packet header |
19 | * | 9 | * |
@@ -188,6 +178,11 @@ enum { | |||
188 | 178 | ||
189 | /* DCCP socket options */ | 179 | /* DCCP socket options */ |
190 | #define DCCP_SOCKOPT_PACKET_SIZE 1 | 180 | #define DCCP_SOCKOPT_PACKET_SIZE 1 |
181 | #define DCCP_SOCKOPT_SERVICE 2 | ||
182 | #define DCCP_SOCKOPT_CCID_RX_INFO 128 | ||
183 | #define DCCP_SOCKOPT_CCID_TX_INFO 192 | ||
184 | |||
185 | #define DCCP_SERVICE_LIST_MAX_LEN 32 | ||
191 | 186 | ||
192 | #ifdef __KERNEL__ | 187 | #ifdef __KERNEL__ |
193 | 188 | ||
@@ -337,7 +332,8 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb) | |||
337 | */ | 332 | */ |
338 | struct dccp_options { | 333 | struct dccp_options { |
339 | __u64 dccpo_sequence_window; | 334 | __u64 dccpo_sequence_window; |
340 | __u8 dccpo_ccid; | 335 | __u8 dccpo_rx_ccid; |
336 | __u8 dccpo_tx_ccid; | ||
341 | __u8 dccpo_send_ack_vector; | 337 | __u8 dccpo_send_ack_vector; |
342 | __u8 dccpo_send_ndp_count; | 338 | __u8 dccpo_send_ndp_count; |
343 | }; | 339 | }; |
@@ -360,14 +356,8 @@ static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req) | |||
360 | 356 | ||
361 | extern struct inet_timewait_death_row dccp_death_row; | 357 | extern struct inet_timewait_death_row dccp_death_row; |
362 | 358 | ||
363 | /* Read about the ECN nonce to see why it is 253 */ | ||
364 | #define DCCP_MAX_ACK_VECTOR_LEN 253 | ||
365 | |||
366 | struct dccp_options_received { | 359 | struct dccp_options_received { |
367 | u32 dccpor_ndp:24, | 360 | u32 dccpor_ndp; /* only 24 bits */ |
368 | dccpor_ack_vector_len:8; | ||
369 | u32 dccpor_ack_vector_idx:10; | ||
370 | /* 22 bits hole, try to pack */ | ||
371 | u32 dccpor_timestamp; | 361 | u32 dccpor_timestamp; |
372 | u32 dccpor_timestamp_echo; | 362 | u32 dccpor_timestamp_echo; |
373 | u32 dccpor_elapsed_time; | 363 | u32 dccpor_elapsed_time; |
@@ -382,6 +372,27 @@ enum dccp_role { | |||
382 | DCCP_ROLE_SERVER, | 372 | DCCP_ROLE_SERVER, |
383 | }; | 373 | }; |
384 | 374 | ||
375 | struct dccp_service_list { | ||
376 | __u32 dccpsl_nr; | ||
377 | __u32 dccpsl_list[0]; | ||
378 | }; | ||
379 | |||
380 | #define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1) | ||
381 | |||
382 | static inline int dccp_list_has_service(const struct dccp_service_list *sl, | ||
383 | const u32 service) | ||
384 | { | ||
385 | if (likely(sl != NULL)) { | ||
386 | u32 i = sl->dccpsl_nr; | ||
387 | while (i--) | ||
388 | if (sl->dccpsl_list[i] == service) | ||
389 | return 1; | ||
390 | } | ||
391 | return 0; | ||
392 | } | ||
393 | |||
394 | struct dccp_ackvec; | ||
395 | |||
385 | /** | 396 | /** |
386 | * struct dccp_sock - DCCP socket state | 397 | * struct dccp_sock - DCCP socket state |
387 | * | 398 | * |
@@ -402,7 +413,7 @@ enum dccp_role { | |||
402 | * @dccps_packet_size - Set thru setsockopt | 413 | * @dccps_packet_size - Set thru setsockopt |
403 | * @dccps_role - Role of this sock, one of %dccp_role | 414 | * @dccps_role - Role of this sock, one of %dccp_role |
404 | * @dccps_ndp_count - number of Non Data Packets since last data packet | 415 | * @dccps_ndp_count - number of Non Data Packets since last data packet |
405 | * @dccps_hc_rx_ackpkts - receiver half connection acked packets | 416 | * @dccps_hc_rx_ackvec - rx half connection ack vector |
406 | */ | 417 | */ |
407 | struct dccp_sock { | 418 | struct dccp_sock { |
408 | /* inet_connection_sock has to be the first member of dccp_sock */ | 419 | /* inet_connection_sock has to be the first member of dccp_sock */ |
@@ -417,7 +428,8 @@ struct dccp_sock { | |||
417 | __u64 dccps_gss; | 428 | __u64 dccps_gss; |
418 | __u64 dccps_gsr; | 429 | __u64 dccps_gsr; |
419 | __u64 dccps_gar; | 430 | __u64 dccps_gar; |
420 | unsigned long dccps_service; | 431 | __u32 dccps_service; |
432 | struct dccp_service_list *dccps_service_list; | ||
421 | struct timeval dccps_timestamp_time; | 433 | struct timeval dccps_timestamp_time; |
422 | __u32 dccps_timestamp_echo; | 434 | __u32 dccps_timestamp_echo; |
423 | __u32 dccps_packet_size; | 435 | __u32 dccps_packet_size; |
@@ -426,7 +438,7 @@ struct dccp_sock { | |||
426 | __u32 dccps_pmtu_cookie; | 438 | __u32 dccps_pmtu_cookie; |
427 | __u32 dccps_mss_cache; | 439 | __u32 dccps_mss_cache; |
428 | struct dccp_options dccps_options; | 440 | struct dccp_options dccps_options; |
429 | struct dccp_ackpkts *dccps_hc_rx_ackpkts; | 441 | struct dccp_ackvec *dccps_hc_rx_ackvec; |
430 | void *dccps_hc_rx_ccid_private; | 442 | void *dccps_hc_rx_ccid_private; |
431 | void *dccps_hc_tx_ccid_private; | 443 | void *dccps_hc_tx_ccid_private; |
432 | struct ccid *dccps_hc_rx_ccid; | 444 | struct ccid *dccps_hc_rx_ccid; |
@@ -443,6 +455,11 @@ static inline struct dccp_sock *dccp_sk(const struct sock *sk) | |||
443 | return (struct dccp_sock *)sk; | 455 | return (struct dccp_sock *)sk; |
444 | } | 456 | } |
445 | 457 | ||
458 | static inline int dccp_service_not_initialized(const struct sock *sk) | ||
459 | { | ||
460 | return dccp_sk(sk)->dccps_service == DCCP_SERVICE_INVALID_VALUE; | ||
461 | } | ||
462 | |||
446 | static inline const char *dccp_role(const struct sock *sk) | 463 | static inline const char *dccp_role(const struct sock *sk) |
447 | { | 464 | { |
448 | switch (dccp_sk(sk)->dccps_role) { | 465 | switch (dccp_sk(sk)->dccps_role) { |