Home | History | Annotate | Download | only in linux
      1 #ifndef _UAPI_INET_DIAG_H_
      2 #define _UAPI_INET_DIAG_H_
      3 
      4 #include <linux/types.h>
      5 
      6 /* Just some random number */
      7 #define TCPDIAG_GETSOCK 18
      8 #define DCCPDIAG_GETSOCK 19
      9 
     10 #define INET_DIAG_GETSOCK_MAX 24
     11 
     12 /* Socket identity */
     13 struct inet_diag_sockid {
     14 	__be16	idiag_sport;
     15 	__be16	idiag_dport;
     16 	__be32	idiag_src[4];
     17 	__be32	idiag_dst[4];
     18 	__u32	idiag_if;
     19 	__u32	idiag_cookie[2];
     20 #define INET_DIAG_NOCOOKIE (~0U)
     21 };
     22 
     23 /* Request structure */
     24 
     25 struct inet_diag_req {
     26 	__u8	idiag_family;		/* Family of addresses. */
     27 	__u8	idiag_src_len;
     28 	__u8	idiag_dst_len;
     29 	__u8	idiag_ext;		/* Query extended information */
     30 
     31 	struct inet_diag_sockid id;
     32 
     33 	__u32	idiag_states;		/* States to dump */
     34 	__u32	idiag_dbs;		/* Tables to dump (NI) */
     35 };
     36 
     37 struct inet_diag_req_v2 {
     38 	__u8	sdiag_family;
     39 	__u8	sdiag_protocol;
     40 	__u8	idiag_ext;
     41 	__u8	pad;
     42 	__u32	idiag_states;
     43 	struct inet_diag_sockid id;
     44 };
     45 
     46 /*
     47  * SOCK_RAW sockets require the underlied protocol to be
     48  * additionally specified so we can use @pad member for
     49  * this, but we can't rename it because userspace programs
     50  * still may depend on this name. Instead lets use another
     51  * structure definition as an alias for struct
     52  * @inet_diag_req_v2.
     53  */
     54 struct inet_diag_req_raw {
     55 	__u8	sdiag_family;
     56 	__u8	sdiag_protocol;
     57 	__u8	idiag_ext;
     58 	__u8	sdiag_raw_protocol;
     59 	__u32	idiag_states;
     60 	struct inet_diag_sockid id;
     61 };
     62 
     63 enum {
     64 	INET_DIAG_REQ_NONE,
     65 	INET_DIAG_REQ_BYTECODE,
     66 };
     67 
     68 #define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE
     69 
     70 /* Bytecode is sequence of 4 byte commands followed by variable arguments.
     71  * All the commands identified by "code" are conditional jumps forward:
     72  * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
     73  * length of the command and its arguments.
     74  */
     75 
     76 struct inet_diag_bc_op {
     77 	unsigned char	code;
     78 	unsigned char	yes;
     79 	unsigned short	no;
     80 };
     81 
     82 enum {
     83 	INET_DIAG_BC_NOP,
     84 	INET_DIAG_BC_JMP,
     85 	INET_DIAG_BC_S_GE,
     86 	INET_DIAG_BC_S_LE,
     87 	INET_DIAG_BC_D_GE,
     88 	INET_DIAG_BC_D_LE,
     89 	INET_DIAG_BC_AUTO,
     90 	INET_DIAG_BC_S_COND,
     91 	INET_DIAG_BC_D_COND,
     92 	INET_DIAG_BC_DEV_COND,   /* u32 ifindex */
     93 	INET_DIAG_BC_MARK_COND,
     94 };
     95 
     96 struct inet_diag_hostcond {
     97 	__u8	family;
     98 	__u8	prefix_len;
     99 	int	port;
    100 	__be32	addr[0];
    101 };
    102 
    103 struct inet_diag_markcond {
    104 	__u32 mark;
    105 	__u32 mask;
    106 };
    107 
    108 /* Base info structure. It contains socket identity (addrs/ports/cookie)
    109  * and, alas, the information shown by netstat. */
    110 struct inet_diag_msg {
    111 	__u8	idiag_family;
    112 	__u8	idiag_state;
    113 	__u8	idiag_timer;
    114 	__u8	idiag_retrans;
    115 
    116 	struct inet_diag_sockid id;
    117 
    118 	__u32	idiag_expires;
    119 	__u32	idiag_rqueue;
    120 	__u32	idiag_wqueue;
    121 	__u32	idiag_uid;
    122 	__u32	idiag_inode;
    123 };
    124 
    125 /* Extensions */
    126 
    127 enum {
    128 	INET_DIAG_NONE,
    129 	INET_DIAG_MEMINFO,
    130 	INET_DIAG_INFO,
    131 	INET_DIAG_VEGASINFO,
    132 	INET_DIAG_CONG,
    133 	INET_DIAG_TOS,
    134 	INET_DIAG_TCLASS,
    135 	INET_DIAG_SKMEMINFO,
    136 	INET_DIAG_SHUTDOWN,
    137 	INET_DIAG_DCTCPINFO,
    138 	INET_DIAG_PROTOCOL,  /* response attribute only */
    139 	INET_DIAG_SKV6ONLY,
    140 	INET_DIAG_LOCALS,
    141 	INET_DIAG_PEERS,
    142 	INET_DIAG_PAD,
    143 	INET_DIAG_MARK,
    144 	INET_DIAG_BBRINFO,
    145 	__INET_DIAG_MAX,
    146 };
    147 
    148 #define INET_DIAG_MAX (__INET_DIAG_MAX - 1)
    149 
    150 /* INET_DIAG_MEM */
    151 
    152 struct inet_diag_meminfo {
    153 	__u32	idiag_rmem;
    154 	__u32	idiag_wmem;
    155 	__u32	idiag_fmem;
    156 	__u32	idiag_tmem;
    157 };
    158 
    159 /* INET_DIAG_VEGASINFO */
    160 
    161 struct tcpvegas_info {
    162 	__u32	tcpv_enabled;
    163 	__u32	tcpv_rttcnt;
    164 	__u32	tcpv_rtt;
    165 	__u32	tcpv_minrtt;
    166 };
    167 
    168 /* INET_DIAG_DCTCPINFO */
    169 
    170 struct tcp_dctcp_info {
    171 	__u16	dctcp_enabled;
    172 	__u16	dctcp_ce_state;
    173 	__u32	dctcp_alpha;
    174 	__u32	dctcp_ab_ecn;
    175 	__u32	dctcp_ab_tot;
    176 };
    177 
    178 /* INET_DIAG_BBRINFO */
    179 
    180 struct tcp_bbr_info {
    181 	/* u64 bw: max-filtered BW (app throughput) estimate in Byte per sec: */
    182 	__u32	bbr_bw_lo;		/* lower 32 bits of bw */
    183 	__u32	bbr_bw_hi;		/* upper 32 bits of bw */
    184 	__u32	bbr_min_rtt;		/* min-filtered RTT in uSec */
    185 	__u32	bbr_pacing_gain;	/* pacing gain shifted left 8 bits */
    186 	__u32	bbr_cwnd_gain;		/* cwnd gain shifted left 8 bits */
    187 };
    188 
    189 union tcp_cc_info {
    190 	struct tcpvegas_info	vegas;
    191 	struct tcp_dctcp_info	dctcp;
    192 	struct tcp_bbr_info	bbr;
    193 };
    194 #endif /* _UAPI_INET_DIAG_H_ */
    195