]>
Commit | Line | Data |
---|---|---|
73c1f4a0 ACM |
1 | #ifndef _INET_DIAG_H_ |
2 | #define _INET_DIAG_H_ 1 | |
1da177e4 LT |
3 | |
4 | /* Just some random number */ | |
5 | #define TCPDIAG_GETSOCK 18 | |
540722ff | 6 | #define DCCPDIAG_GETSOCK 19 |
1da177e4 | 7 | |
4f5736c4 ACM |
8 | #define INET_DIAG_GETSOCK_MAX 24 |
9 | ||
1da177e4 | 10 | /* Socket identity */ |
73c1f4a0 | 11 | struct inet_diag_sockid { |
9f855299 AV |
12 | __be16 idiag_sport; |
13 | __be16 idiag_dport; | |
14 | __be32 idiag_src[4]; | |
15 | __be32 idiag_dst[4]; | |
73c1f4a0 ACM |
16 | __u32 idiag_if; |
17 | __u32 idiag_cookie[2]; | |
18 | #define INET_DIAG_NOCOOKIE (~0U) | |
1da177e4 LT |
19 | }; |
20 | ||
21 | /* Request structure */ | |
22 | ||
73c1f4a0 ACM |
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 */ | |
1da177e4 | 28 | |
73c1f4a0 | 29 | struct inet_diag_sockid id; |
1da177e4 | 30 | |
73c1f4a0 ACM |
31 | __u32 idiag_states; /* States to dump */ |
32 | __u32 idiag_dbs; /* Tables to dump (NI) */ | |
1da177e4 LT |
33 | }; |
34 | ||
73c1f4a0 ACM |
35 | enum { |
36 | INET_DIAG_REQ_NONE, | |
37 | INET_DIAG_REQ_BYTECODE, | |
1da177e4 LT |
38 | }; |
39 | ||
73c1f4a0 | 40 | #define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE |
1da177e4 LT |
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 | ||
73c1f4a0 | 48 | struct inet_diag_bc_op { |
1da177e4 LT |
49 | unsigned char code; |
50 | unsigned char yes; | |
51 | unsigned short no; | |
52 | }; | |
53 | ||
73c1f4a0 ACM |
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, | |
1da177e4 LT |
64 | }; |
65 | ||
73c1f4a0 | 66 | struct inet_diag_hostcond { |
1da177e4 LT |
67 | __u8 family; |
68 | __u8 prefix_len; | |
69 | int port; | |
9f855299 | 70 | __be32 addr[0]; |
1da177e4 LT |
71 | }; |
72 | ||
73 | /* Base info structure. It contains socket identity (addrs/ports/cookie) | |
74 | * and, alas, the information shown by netstat. */ | |
73c1f4a0 ACM |
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; | |
1da177e4 LT |
88 | }; |
89 | ||
90 | /* Extensions */ | |
91 | ||
73c1f4a0 ACM |
92 | enum { |
93 | INET_DIAG_NONE, | |
94 | INET_DIAG_MEMINFO, | |
95 | INET_DIAG_INFO, | |
96 | INET_DIAG_VEGASINFO, | |
97 | INET_DIAG_CONG, | |
1da177e4 LT |
98 | }; |
99 | ||
73c1f4a0 | 100 | #define INET_DIAG_MAX INET_DIAG_CONG |
1da177e4 LT |
101 | |
102 | ||
73c1f4a0 | 103 | /* INET_DIAG_MEM */ |
1da177e4 | 104 | |
73c1f4a0 ACM |
105 | struct inet_diag_meminfo { |
106 | __u32 idiag_rmem; | |
107 | __u32 idiag_wmem; | |
108 | __u32 idiag_fmem; | |
109 | __u32 idiag_tmem; | |
1da177e4 LT |
110 | }; |
111 | ||
73c1f4a0 | 112 | /* INET_DIAG_VEGASINFO */ |
1da177e4 LT |
113 | |
114 | struct tcpvegas_info { | |
115 | __u32 tcpv_enabled; | |
116 | __u32 tcpv_rttcnt; | |
117 | __u32 tcpv_rtt; | |
118 | __u32 tcpv_minrtt; | |
119 | }; | |
120 | ||
4f5736c4 ACM |
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, | |
73c1f4a0 | 128 | struct inet_diag_msg *r, |
4f5736c4 ACM |
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 | ||
73c1f4a0 | 138 | #endif /* _INET_DIAG_H_ */ |