diff options
Diffstat (limited to 'include/linux/dccp.h')
-rw-r--r-- | include/linux/dccp.h | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 8bf4bacb5051..0e72708677e4 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,9 @@ 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 | |||
183 | #define DCCP_SERVICE_LIST_MAX_LEN 32 | ||
191 | 184 | ||
192 | #ifdef __KERNEL__ | 185 | #ifdef __KERNEL__ |
193 | 186 | ||
@@ -382,6 +375,25 @@ enum dccp_role { | |||
382 | DCCP_ROLE_SERVER, | 375 | DCCP_ROLE_SERVER, |
383 | }; | 376 | }; |
384 | 377 | ||
378 | struct dccp_service_list { | ||
379 | __u32 dccpsl_nr; | ||
380 | __u32 dccpsl_list[0]; | ||
381 | }; | ||
382 | |||
383 | #define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1) | ||
384 | |||
385 | static inline int dccp_list_has_service(const struct dccp_service_list *sl, | ||
386 | const u32 service) | ||
387 | { | ||
388 | if (likely(sl != NULL)) { | ||
389 | u32 i = sl->dccpsl_nr; | ||
390 | while (i--) | ||
391 | if (sl->dccpsl_list[i] == service) | ||
392 | return 1; | ||
393 | } | ||
394 | return 0; | ||
395 | } | ||
396 | |||
385 | /** | 397 | /** |
386 | * struct dccp_sock - DCCP socket state | 398 | * struct dccp_sock - DCCP socket state |
387 | * | 399 | * |
@@ -417,7 +429,8 @@ struct dccp_sock { | |||
417 | __u64 dccps_gss; | 429 | __u64 dccps_gss; |
418 | __u64 dccps_gsr; | 430 | __u64 dccps_gsr; |
419 | __u64 dccps_gar; | 431 | __u64 dccps_gar; |
420 | unsigned long dccps_service; | 432 | __u32 dccps_service; |
433 | struct dccp_service_list *dccps_service_list; | ||
421 | struct timeval dccps_timestamp_time; | 434 | struct timeval dccps_timestamp_time; |
422 | __u32 dccps_timestamp_echo; | 435 | __u32 dccps_timestamp_echo; |
423 | __u32 dccps_packet_size; | 436 | __u32 dccps_packet_size; |
@@ -443,6 +456,11 @@ static inline struct dccp_sock *dccp_sk(const struct sock *sk) | |||
443 | return (struct dccp_sock *)sk; | 456 | return (struct dccp_sock *)sk; |
444 | } | 457 | } |
445 | 458 | ||
459 | static inline int dccp_service_not_initialized(const struct sock *sk) | ||
460 | { | ||
461 | return dccp_sk(sk)->dccps_service == DCCP_SERVICE_INVALID_VALUE; | ||
462 | } | ||
463 | |||
446 | static inline const char *dccp_role(const struct sock *sk) | 464 | static inline const char *dccp_role(const struct sock *sk) |
447 | { | 465 | { |
448 | switch (dccp_sk(sk)->dccps_role) { | 466 | switch (dccp_sk(sk)->dccps_role) { |