1607ca46eSDavid Howells #ifndef _UAPI_INET_DIAG_H_ 2607ca46eSDavid Howells #define _UAPI_INET_DIAG_H_ 3607ca46eSDavid Howells 4607ca46eSDavid Howells #include <linux/types.h> 5607ca46eSDavid Howells 6607ca46eSDavid Howells /* Just some random number */ 7607ca46eSDavid Howells #define TCPDIAG_GETSOCK 18 8607ca46eSDavid Howells #define DCCPDIAG_GETSOCK 19 9607ca46eSDavid Howells 10607ca46eSDavid Howells #define INET_DIAG_GETSOCK_MAX 24 11607ca46eSDavid Howells 12607ca46eSDavid Howells /* Socket identity */ 13607ca46eSDavid Howells struct inet_diag_sockid { 14607ca46eSDavid Howells __be16 idiag_sport; 15607ca46eSDavid Howells __be16 idiag_dport; 16607ca46eSDavid Howells __be32 idiag_src[4]; 17607ca46eSDavid Howells __be32 idiag_dst[4]; 18607ca46eSDavid Howells __u32 idiag_if; 19607ca46eSDavid Howells __u32 idiag_cookie[2]; 20607ca46eSDavid Howells #define INET_DIAG_NOCOOKIE (~0U) 21607ca46eSDavid Howells }; 22607ca46eSDavid Howells 23607ca46eSDavid Howells /* Request structure */ 24607ca46eSDavid Howells 25607ca46eSDavid Howells struct inet_diag_req { 26607ca46eSDavid Howells __u8 idiag_family; /* Family of addresses. */ 27607ca46eSDavid Howells __u8 idiag_src_len; 28607ca46eSDavid Howells __u8 idiag_dst_len; 29607ca46eSDavid Howells __u8 idiag_ext; /* Query extended information */ 30607ca46eSDavid Howells 31607ca46eSDavid Howells struct inet_diag_sockid id; 32607ca46eSDavid Howells 33607ca46eSDavid Howells __u32 idiag_states; /* States to dump */ 34607ca46eSDavid Howells __u32 idiag_dbs; /* Tables to dump (NI) */ 35607ca46eSDavid Howells }; 36607ca46eSDavid Howells 37607ca46eSDavid Howells struct inet_diag_req_v2 { 38607ca46eSDavid Howells __u8 sdiag_family; 39607ca46eSDavid Howells __u8 sdiag_protocol; 40607ca46eSDavid Howells __u8 idiag_ext; 41607ca46eSDavid Howells __u8 pad; 42607ca46eSDavid Howells __u32 idiag_states; 43607ca46eSDavid Howells struct inet_diag_sockid id; 44607ca46eSDavid Howells }; 45607ca46eSDavid Howells 46607ca46eSDavid Howells enum { 47607ca46eSDavid Howells INET_DIAG_REQ_NONE, 48607ca46eSDavid Howells INET_DIAG_REQ_BYTECODE, 49607ca46eSDavid Howells }; 50607ca46eSDavid Howells 51607ca46eSDavid Howells #define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE 52607ca46eSDavid Howells 53607ca46eSDavid Howells /* Bytecode is sequence of 4 byte commands followed by variable arguments. 54607ca46eSDavid Howells * All the commands identified by "code" are conditional jumps forward: 55607ca46eSDavid Howells * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be 56607ca46eSDavid Howells * length of the command and its arguments. 57607ca46eSDavid Howells */ 58607ca46eSDavid Howells 59607ca46eSDavid Howells struct inet_diag_bc_op { 60607ca46eSDavid Howells unsigned char code; 61607ca46eSDavid Howells unsigned char yes; 62607ca46eSDavid Howells unsigned short no; 63607ca46eSDavid Howells }; 64607ca46eSDavid Howells 65607ca46eSDavid Howells enum { 66607ca46eSDavid Howells INET_DIAG_BC_NOP, 67607ca46eSDavid Howells INET_DIAG_BC_JMP, 68607ca46eSDavid Howells INET_DIAG_BC_S_GE, 69607ca46eSDavid Howells INET_DIAG_BC_S_LE, 70607ca46eSDavid Howells INET_DIAG_BC_D_GE, 71607ca46eSDavid Howells INET_DIAG_BC_D_LE, 72607ca46eSDavid Howells INET_DIAG_BC_AUTO, 73607ca46eSDavid Howells INET_DIAG_BC_S_COND, 74607ca46eSDavid Howells INET_DIAG_BC_D_COND, 75607ca46eSDavid Howells }; 76607ca46eSDavid Howells 77607ca46eSDavid Howells struct inet_diag_hostcond { 78607ca46eSDavid Howells __u8 family; 79607ca46eSDavid Howells __u8 prefix_len; 80607ca46eSDavid Howells int port; 81607ca46eSDavid Howells __be32 addr[0]; 82607ca46eSDavid Howells }; 83607ca46eSDavid Howells 84607ca46eSDavid Howells /* Base info structure. It contains socket identity (addrs/ports/cookie) 85607ca46eSDavid Howells * and, alas, the information shown by netstat. */ 86607ca46eSDavid Howells struct inet_diag_msg { 87607ca46eSDavid Howells __u8 idiag_family; 88607ca46eSDavid Howells __u8 idiag_state; 89607ca46eSDavid Howells __u8 idiag_timer; 90607ca46eSDavid Howells __u8 idiag_retrans; 91607ca46eSDavid Howells 92607ca46eSDavid Howells struct inet_diag_sockid id; 93607ca46eSDavid Howells 94607ca46eSDavid Howells __u32 idiag_expires; 95607ca46eSDavid Howells __u32 idiag_rqueue; 96607ca46eSDavid Howells __u32 idiag_wqueue; 97607ca46eSDavid Howells __u32 idiag_uid; 98607ca46eSDavid Howells __u32 idiag_inode; 99607ca46eSDavid Howells }; 100607ca46eSDavid Howells 101607ca46eSDavid Howells /* Extensions */ 102607ca46eSDavid Howells 103607ca46eSDavid Howells enum { 104607ca46eSDavid Howells INET_DIAG_NONE, 105607ca46eSDavid Howells INET_DIAG_MEMINFO, 106607ca46eSDavid Howells INET_DIAG_INFO, 107607ca46eSDavid Howells INET_DIAG_VEGASINFO, 108607ca46eSDavid Howells INET_DIAG_CONG, 109607ca46eSDavid Howells INET_DIAG_TOS, 110607ca46eSDavid Howells INET_DIAG_TCLASS, 111607ca46eSDavid Howells INET_DIAG_SKMEMINFO, 112e4e541a8SPavel Emelyanov INET_DIAG_SHUTDOWN, 113e3118e83SDaniel Borkmann INET_DIAG_DCTCPINFO, 11435ac838aSCraig Gallek INET_DIAG_PROTOCOL, /* response attribute only */ 11520462155SPhil Sutter INET_DIAG_SKV6ONLY, 1168f840e47SXin Long INET_DIAG_LOCALS, 1178f840e47SXin Long INET_DIAG_PEERS, 118*6ed46d12SNicolas Dichtel INET_DIAG_PAD, 119*6ed46d12SNicolas Dichtel __INET_DIAG_MAX, 120607ca46eSDavid Howells }; 121607ca46eSDavid Howells 122*6ed46d12SNicolas Dichtel #define INET_DIAG_MAX (__INET_DIAG_MAX - 1) 123607ca46eSDavid Howells 124607ca46eSDavid Howells /* INET_DIAG_MEM */ 125607ca46eSDavid Howells 126607ca46eSDavid Howells struct inet_diag_meminfo { 127607ca46eSDavid Howells __u32 idiag_rmem; 128607ca46eSDavid Howells __u32 idiag_wmem; 129607ca46eSDavid Howells __u32 idiag_fmem; 130607ca46eSDavid Howells __u32 idiag_tmem; 131607ca46eSDavid Howells }; 132607ca46eSDavid Howells 133607ca46eSDavid Howells /* INET_DIAG_VEGASINFO */ 134607ca46eSDavid Howells 135607ca46eSDavid Howells struct tcpvegas_info { 136607ca46eSDavid Howells __u32 tcpv_enabled; 137607ca46eSDavid Howells __u32 tcpv_rttcnt; 138607ca46eSDavid Howells __u32 tcpv_rtt; 139607ca46eSDavid Howells __u32 tcpv_minrtt; 140607ca46eSDavid Howells }; 141607ca46eSDavid Howells 142e3118e83SDaniel Borkmann /* INET_DIAG_DCTCPINFO */ 143e3118e83SDaniel Borkmann 144e3118e83SDaniel Borkmann struct tcp_dctcp_info { 145e3118e83SDaniel Borkmann __u16 dctcp_enabled; 146e3118e83SDaniel Borkmann __u16 dctcp_ce_state; 147e3118e83SDaniel Borkmann __u32 dctcp_alpha; 148e3118e83SDaniel Borkmann __u32 dctcp_ab_ecn; 149e3118e83SDaniel Borkmann __u32 dctcp_ab_tot; 150e3118e83SDaniel Borkmann }; 151607ca46eSDavid Howells 15264f40ff5SEric Dumazet union tcp_cc_info { 15364f40ff5SEric Dumazet struct tcpvegas_info vegas; 15464f40ff5SEric Dumazet struct tcp_dctcp_info dctcp; 15564f40ff5SEric Dumazet }; 156607ca46eSDavid Howells #endif /* _UAPI_INET_DIAG_H_ */ 157