blob: 190494ebcfb880cb545c1e398c12f622c5582db1 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _TCP_DIAG_H_
2#define _TCP_DIAG_H_ 1
3
4/* Just some random number */
5#define TCPDIAG_GETSOCK 18
Arnaldo Carvalho de Melo540722f2005-08-10 05:54:28 -03006#define DCCPDIAG_GETSOCK 19
Linus Torvalds1da177e2005-04-16 15:20:36 -07007
8/* Socket identity */
9struct tcpdiag_sockid
10{
11 __u16 tcpdiag_sport;
12 __u16 tcpdiag_dport;
13 __u32 tcpdiag_src[4];
14 __u32 tcpdiag_dst[4];
15 __u32 tcpdiag_if;
16 __u32 tcpdiag_cookie[2];
17#define TCPDIAG_NOCOOKIE (~0U)
18};
19
20/* Request structure */
21
22struct tcpdiagreq
23{
24 __u8 tcpdiag_family; /* Family of addresses. */
25 __u8 tcpdiag_src_len;
26 __u8 tcpdiag_dst_len;
27 __u8 tcpdiag_ext; /* Query extended information */
28
29 struct tcpdiag_sockid id;
30
31 __u32 tcpdiag_states; /* States to dump */
32 __u32 tcpdiag_dbs; /* Tables to dump (NI) */
33};
34
35enum
36{
37 TCPDIAG_REQ_NONE,
38 TCPDIAG_REQ_BYTECODE,
39};
40
41#define TCPDIAG_REQ_MAX TCPDIAG_REQ_BYTECODE
42
43/* Bytecode is sequence of 4 byte commands followed by variable arguments.
44 * All the commands identified by "code" are conditional jumps forward:
45 * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
46 * length of the command and its arguments.
47 */
48
49struct tcpdiag_bc_op
50{
51 unsigned char code;
52 unsigned char yes;
53 unsigned short no;
54};
55
56enum
57{
58 TCPDIAG_BC_NOP,
59 TCPDIAG_BC_JMP,
60 TCPDIAG_BC_S_GE,
61 TCPDIAG_BC_S_LE,
62 TCPDIAG_BC_D_GE,
63 TCPDIAG_BC_D_LE,
64 TCPDIAG_BC_AUTO,
65 TCPDIAG_BC_S_COND,
66 TCPDIAG_BC_D_COND,
67};
68
69struct tcpdiag_hostcond
70{
71 __u8 family;
72 __u8 prefix_len;
73 int port;
74 __u32 addr[0];
75};
76
77/* Base info structure. It contains socket identity (addrs/ports/cookie)
78 * and, alas, the information shown by netstat. */
79struct tcpdiagmsg
80{
81 __u8 tcpdiag_family;
82 __u8 tcpdiag_state;
83 __u8 tcpdiag_timer;
84 __u8 tcpdiag_retrans;
85
86 struct tcpdiag_sockid id;
87
88 __u32 tcpdiag_expires;
89 __u32 tcpdiag_rqueue;
90 __u32 tcpdiag_wqueue;
91 __u32 tcpdiag_uid;
92 __u32 tcpdiag_inode;
93};
94
95/* Extensions */
96
97enum
98{
99 TCPDIAG_NONE,
100 TCPDIAG_MEMINFO,
101 TCPDIAG_INFO,
102 TCPDIAG_VEGASINFO,
Stephen Hemminger056ede62005-06-23 12:21:28 -0700103 TCPDIAG_CONG,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104};
105
Stephen Hemminger056ede62005-06-23 12:21:28 -0700106#define TCPDIAG_MAX TCPDIAG_CONG
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107
108
109/* TCPDIAG_MEM */
110
111struct tcpdiag_meminfo
112{
113 __u32 tcpdiag_rmem;
114 __u32 tcpdiag_wmem;
115 __u32 tcpdiag_fmem;
116 __u32 tcpdiag_tmem;
117};
118
119/* TCPDIAG_VEGASINFO */
120
121struct tcpvegas_info {
122 __u32 tcpv_enabled;
123 __u32 tcpv_rttcnt;
124 __u32 tcpv_rtt;
125 __u32 tcpv_minrtt;
126};
127
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128#endif /* _TCP_DIAG_H_ */