diff options
Diffstat (limited to 'include/linux/inet_diag.h')
-rw-r--r-- | include/linux/inet_diag.h | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h new file mode 100644 index 000000000000..a4606e5810e5 --- /dev/null +++ b/include/linux/inet_diag.h | |||
@@ -0,0 +1,138 @@ | |||
1 | #ifndef _INET_DIAG_H_ | ||
2 | #define _INET_DIAG_H_ 1 | ||
3 | |||
4 | /* Just some random number */ | ||
5 | #define TCPDIAG_GETSOCK 18 | ||
6 | #define DCCPDIAG_GETSOCK 19 | ||
7 | |||
8 | #define INET_DIAG_GETSOCK_MAX 24 | ||
9 | |||
10 | /* Socket identity */ | ||
11 | struct inet_diag_sockid { | ||
12 | __u16 idiag_sport; | ||
13 | __u16 idiag_dport; | ||
14 | __u32 idiag_src[4]; | ||
15 | __u32 idiag_dst[4]; | ||
16 | __u32 idiag_if; | ||
17 | __u32 idiag_cookie[2]; | ||
18 | #define INET_DIAG_NOCOOKIE (~0U) | ||
19 | }; | ||
20 | |||
21 | /* Request structure */ | ||
22 | |||
23 | struct inet_diag_req { | ||
24 | __u8 idiag_family; /* Family of addresses. */ | ||
25 | __u8 idiag_src_len; | ||
26 | __u8 idiag_dst_len; | ||
27 | __u8 idiag_ext; /* Query extended information */ | ||
28 | |||
29 | struct inet_diag_sockid id; | ||
30 | |||
31 | __u32 idiag_states; /* States to dump */ | ||
32 | __u32 idiag_dbs; /* Tables to dump (NI) */ | ||
33 | }; | ||
34 | |||
35 | enum { | ||
36 | INET_DIAG_REQ_NONE, | ||
37 | INET_DIAG_REQ_BYTECODE, | ||
38 | }; | ||
39 | |||
40 | #define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE | ||
41 | |||
42 | /* Bytecode is sequence of 4 byte commands followed by variable arguments. | ||
43 | * All the commands identified by "code" are conditional jumps forward: | ||
44 | * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be | ||
45 | * length of the command and its arguments. | ||
46 | */ | ||
47 | |||
48 | struct inet_diag_bc_op { | ||
49 | unsigned char code; | ||
50 | unsigned char yes; | ||
51 | unsigned short no; | ||
52 | }; | ||
53 | |||
54 | enum { | ||
55 | INET_DIAG_BC_NOP, | ||
56 | INET_DIAG_BC_JMP, | ||
57 | INET_DIAG_BC_S_GE, | ||
58 | INET_DIAG_BC_S_LE, | ||
59 | INET_DIAG_BC_D_GE, | ||
60 | INET_DIAG_BC_D_LE, | ||
61 | INET_DIAG_BC_AUTO, | ||
62 | INET_DIAG_BC_S_COND, | ||
63 | INET_DIAG_BC_D_COND, | ||
64 | }; | ||
65 | |||
66 | struct inet_diag_hostcond { | ||
67 | __u8 family; | ||
68 | __u8 prefix_len; | ||
69 | int port; | ||
70 | __u32 addr[0]; | ||
71 | }; | ||
72 | |||
73 | /* Base info structure. It contains socket identity (addrs/ports/cookie) | ||
74 | * and, alas, the information shown by netstat. */ | ||
75 | struct inet_diag_msg { | ||
76 | __u8 idiag_family; | ||
77 | __u8 idiag_state; | ||
78 | __u8 idiag_timer; | ||
79 | __u8 idiag_retrans; | ||
80 | |||
81 | struct inet_diag_sockid id; | ||
82 | |||
83 | __u32 idiag_expires; | ||
84 | __u32 idiag_rqueue; | ||
85 | __u32 idiag_wqueue; | ||
86 | __u32 idiag_uid; | ||
87 | __u32 idiag_inode; | ||
88 | }; | ||
89 | |||
90 | /* Extensions */ | ||
91 | |||
92 | enum { | ||
93 | INET_DIAG_NONE, | ||
94 | INET_DIAG_MEMINFO, | ||
95 | INET_DIAG_INFO, | ||
96 | INET_DIAG_VEGASINFO, | ||
97 | INET_DIAG_CONG, | ||
98 | }; | ||
99 | |||
100 | #define INET_DIAG_MAX INET_DIAG_CONG | ||
101 | |||
102 | |||
103 | /* INET_DIAG_MEM */ | ||
104 | |||
105 | struct inet_diag_meminfo { | ||
106 | __u32 idiag_rmem; | ||
107 | __u32 idiag_wmem; | ||
108 | __u32 idiag_fmem; | ||
109 | __u32 idiag_tmem; | ||
110 | }; | ||
111 | |||
112 | /* INET_DIAG_VEGASINFO */ | ||
113 | |||
114 | struct tcpvegas_info { | ||
115 | __u32 tcpv_enabled; | ||
116 | __u32 tcpv_rttcnt; | ||
117 | __u32 tcpv_rtt; | ||
118 | __u32 tcpv_minrtt; | ||
119 | }; | ||
120 | |||
121 | #ifdef __KERNEL__ | ||
122 | struct sock; | ||
123 | struct inet_hashinfo; | ||
124 | |||
125 | struct inet_diag_handler { | ||
126 | struct inet_hashinfo *idiag_hashinfo; | ||
127 | void (*idiag_get_info)(struct sock *sk, | ||
128 | struct inet_diag_msg *r, | ||
129 | void *info); | ||
130 | __u16 idiag_info_size; | ||
131 | __u16 idiag_type; | ||
132 | }; | ||
133 | |||
134 | extern int inet_diag_register(const struct inet_diag_handler *handler); | ||
135 | extern void inet_diag_unregister(const struct inet_diag_handler *handler); | ||
136 | #endif /* __KERNEL__ */ | ||
137 | |||
138 | #endif /* _INET_DIAG_H_ */ | ||