Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 */ |
| 8 | struct 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 | |
| 21 | struct 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 | |
| 34 | enum |
| 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 | |
| 48 | struct tcpdiag_bc_op |
| 49 | { |
| 50 | unsigned char code; |
| 51 | unsigned char yes; |
| 52 | unsigned short no; |
| 53 | }; |
| 54 | |
| 55 | enum |
| 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 | |
| 68 | struct 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. */ |
| 78 | struct 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 | |
| 96 | enum |
| 97 | { |
| 98 | TCPDIAG_NONE, |
| 99 | TCPDIAG_MEMINFO, |
| 100 | TCPDIAG_INFO, |
| 101 | TCPDIAG_VEGASINFO, |
Stephen Hemminger | 056ede6 | 2005-06-23 12:21:28 -0700 | [diff] [blame] | 102 | TCPDIAG_CONG, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | }; |
| 104 | |
Stephen Hemminger | 056ede6 | 2005-06-23 12:21:28 -0700 | [diff] [blame] | 105 | #define TCPDIAG_MAX TCPDIAG_CONG |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | |
| 107 | |
| 108 | /* TCPDIAG_MEM */ |
| 109 | |
| 110 | struct tcpdiag_meminfo |
| 111 | { |
| 112 | __u32 tcpdiag_rmem; |
| 113 | __u32 tcpdiag_wmem; |
| 114 | __u32 tcpdiag_fmem; |
| 115 | __u32 tcpdiag_tmem; |
| 116 | }; |
| 117 | |
| 118 | /* TCPDIAG_VEGASINFO */ |
| 119 | |
| 120 | struct tcpvegas_info { |
| 121 | __u32 tcpv_enabled; |
| 122 | __u32 tcpv_rttcnt; |
| 123 | __u32 tcpv_rtt; |
| 124 | __u32 tcpv_minrtt; |
| 125 | }; |
| 126 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | #endif /* _TCP_DIAG_H_ */ |