summaryrefslogtreecommitdiffstats
path: root/include/linux/tcp_diag.h
blob: 7a5996743946806feecb65274be02b328508ca70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#ifndef _TCP_DIAG_H_
#define _TCP_DIAG_H_ 1

/* Just some random number */
#define TCPDIAG_GETSOCK 18

/* Socket identity */
struct tcpdiag_sockid
{
	__u16	tcpdiag_sport;
	__u16	tcpdiag_dport;
	__u32	tcpdiag_src[4];
	__u32	tcpdiag_dst[4];
	__u32	tcpdiag_if;
	__u32	tcpdiag_cookie[2];
#define TCPDIAG_NOCOOKIE (~0U)
};

/* Request structure */

struct tcpdiagreq
{
	__u8	tcpdiag_family;		/* Family of addresses. */
	__u8	tcpdiag_src_len;
	__u8	tcpdiag_dst_len;
	__u8	tcpdiag_ext;		/* Query extended information */

	struct tcpdiag_sockid id;

	__u32	tcpdiag_states;		/* States to dump */
	__u32	tcpdiag_dbs;		/* Tables to dump (NI) */
};

enum
{
	TCPDIAG_REQ_NONE,
	TCPDIAG_REQ_BYTECODE,
};

#define TCPDIAG_REQ_MAX TCPDIAG_REQ_BYTECODE

/* Bytecode is sequence of 4 byte commands followed by variable arguments.
 * All the commands identified by "code" are conditional jumps forward:
 * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
 * length of the command and its arguments.
 */
 
struct tcpdiag_bc_op
{
	unsigned char	code;
	unsigned char	yes;
	unsigned short	no;
};

enum
{
	TCPDIAG_BC_NOP,
	TCPDIAG_BC_JMP,
	TCPDIAG_BC_S_GE,
	TCPDIAG_BC_S_LE,
	TCPDIAG_BC_D_GE,
	TCPDIAG_BC_D_LE,
	TCPDIAG_BC_AUTO,
	TCPDIAG_BC_S_COND,
	TCPDIAG_BC_D_COND,
};

struct tcpdiag_hostcond
{
	__u8	family;
	__u8	prefix_len;
	int	port;
	__u32	addr[0];
};

/* Base info structure. It contains socket identity (addrs/ports/cookie)
 * and, alas, the information shown by netstat. */
struct tcpdiagmsg
{
	__u8	tcpdiag_family;
	__u8	tcpdiag_state;
	__u8	tcpdiag_timer;
	__u8	tcpdiag_retrans;

	struct tcpdiag_sockid id;

	__u32	tcpdiag_expires;
	__u32	tcpdiag_rqueue;
	__u32	tcpdiag_wqueue;
	__u32	tcpdiag_uid;
	__u32	tcpdiag_inode;
};

/* Extensions */

enum
{
	TCPDIAG_NONE,
	TCPDIAG_MEMINFO,
	TCPDIAG_INFO,
	TCPDIAG_VEGASINFO,
	TCPDIAG_CONG,
};

#define TCPDIAG_MAX TCPDIAG_CONG


/* TCPDIAG_MEM */

struct tcpdiag_meminfo
{
	__u32	tcpdiag_rmem;
	__u32	tcpdiag_wmem;
	__u32	tcpdiag_fmem;
	__u32	tcpdiag_tmem;
};

/* TCPDIAG_VEGASINFO */

struct tcpvegas_info {
	__u32	tcpv_enabled;
	__u32	tcpv_rttcnt;
	__u32	tcpv_rtt;
	__u32	tcpv_minrtt;
};

#endif /* _TCP_DIAG_H_ */