Linux v2.6.16-rc1
[linux-2.6/next.git] / include / linux / inet_diag.h
bloba4606e5810e570ae28158f6b73839f81585b231f
1 #ifndef _INET_DIAG_H_
2 #define _INET_DIAG_H_ 1
4 /* Just some random number */
5 #define TCPDIAG_GETSOCK 18
6 #define DCCPDIAG_GETSOCK 19
8 #define INET_DIAG_GETSOCK_MAX 24
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)
21 /* Request structure */
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 */
29 struct inet_diag_sockid id;
31 __u32 idiag_states; /* States to dump */
32 __u32 idiag_dbs; /* Tables to dump (NI) */
35 enum {
36 INET_DIAG_REQ_NONE,
37 INET_DIAG_REQ_BYTECODE,
40 #define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE
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.
48 struct inet_diag_bc_op {
49 unsigned char code;
50 unsigned char yes;
51 unsigned short no;
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,
66 struct inet_diag_hostcond {
67 __u8 family;
68 __u8 prefix_len;
69 int port;
70 __u32 addr[0];
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;
81 struct inet_diag_sockid id;
83 __u32 idiag_expires;
84 __u32 idiag_rqueue;
85 __u32 idiag_wqueue;
86 __u32 idiag_uid;
87 __u32 idiag_inode;
90 /* Extensions */
92 enum {
93 INET_DIAG_NONE,
94 INET_DIAG_MEMINFO,
95 INET_DIAG_INFO,
96 INET_DIAG_VEGASINFO,
97 INET_DIAG_CONG,
100 #define INET_DIAG_MAX INET_DIAG_CONG
103 /* INET_DIAG_MEM */
105 struct inet_diag_meminfo {
106 __u32 idiag_rmem;
107 __u32 idiag_wmem;
108 __u32 idiag_fmem;
109 __u32 idiag_tmem;
112 /* INET_DIAG_VEGASINFO */
114 struct tcpvegas_info {
115 __u32 tcpv_enabled;
116 __u32 tcpv_rttcnt;
117 __u32 tcpv_rtt;
118 __u32 tcpv_minrtt;
121 #ifdef __KERNEL__
122 struct sock;
123 struct inet_hashinfo;
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;
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__ */
138 #endif /* _INET_DIAG_H_ */