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