inet_diag.h 3.4 KB

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