1#ifndef _TCP_DIAG_H_
2#define _TCP_DIAG_H_ 1
3
4/* Just some random number */
5#define TCPDIAG_GETSOCK 18
6
7/* Socket identity */
8struct tcpdiag_sockid
9{
10	__u16	tcpdiag_sport;
11	__u16	tcpdiag_dport;
12	__u32	tcpdiag_src[4];
13	__u32	tcpdiag_dst[4];
14	__u32	tcpdiag_if;
15	__u32	tcpdiag_cookie[2];
16#define TCPDIAG_NOCOOKIE (~0U)
17};
18
19/* Request structure */
20
21struct tcpdiagreq
22{
23	__u8	tcpdiag_family;		/* Family of addresses. */
24	__u8	tcpdiag_src_len;
25	__u8	tcpdiag_dst_len;
26	__u8	tcpdiag_ext;		/* Query extended information */
27
28	struct tcpdiag_sockid id;
29
30	__u32	tcpdiag_states;		/* States to dump */
31	__u32	tcpdiag_dbs;		/* Tables to dump (NI) */
32};
33
34enum
35{
36	TCPDIAG_REQ_NONE,
37	TCPDIAG_REQ_BYTECODE,
38};
39
40#define TCPDIAG_REQ_MAX TCPDIAG_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
48struct tcpdiag_bc_op
49{
50	unsigned char	code;
51	unsigned char	yes;
52	unsigned short	no;
53};
54
55enum
56{
57	TCPDIAG_BC_NOP,
58	TCPDIAG_BC_JMP,
59	TCPDIAG_BC_S_GE,
60	TCPDIAG_BC_S_LE,
61	TCPDIAG_BC_D_GE,
62	TCPDIAG_BC_D_LE,
63	TCPDIAG_BC_AUTO,
64	TCPDIAG_BC_S_COND,
65	TCPDIAG_BC_D_COND,
66};
67
68struct tcpdiag_hostcond
69{
70	__u8	family;
71	__u8	prefix_len;
72	int	port;
73	__u32	addr[0];
74};
75
76/* Base info structure. It contains socket identity (addrs/ports/cookie)
77 * and, alas, the information shown by netstat. */
78struct tcpdiagmsg
79{
80	__u8	tcpdiag_family;
81	__u8	tcpdiag_state;
82	__u8	tcpdiag_timer;
83	__u8	tcpdiag_retrans;
84
85	struct tcpdiag_sockid id;
86
87	__u32	tcpdiag_expires;
88	__u32	tcpdiag_rqueue;
89	__u32	tcpdiag_wqueue;
90	__u32	tcpdiag_uid;
91	__u32	tcpdiag_inode;
92};
93
94/* Extensions */
95
96enum
97{
98	TCPDIAG_NONE,
99	TCPDIAG_MEMINFO,
100	TCPDIAG_INFO,
101};
102
103#define TCPDIAG_MAX TCPDIAG_INFO
104
105
106/* TCPDIAG_MEM */
107
108struct tcpdiag_meminfo
109{
110	__u32	tcpdiag_rmem;
111	__u32	tcpdiag_wmem;
112	__u32	tcpdiag_fmem;
113	__u32	tcpdiag_tmem;
114};
115
116#endif /* _TCP_DIAG_H_ */
117