inet_diag.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. };
  62. struct inet_diag_hostcond {
  63. __u8 family;
  64. __u8 prefix_len;
  65. int port;
  66. __be32 addr[0];
  67. };
  68. /* Base info structure. It contains socket identity (addrs/ports/cookie)
  69. * and, alas, the information shown by netstat. */
  70. struct inet_diag_msg {
  71. __u8 idiag_family;
  72. __u8 idiag_state;
  73. __u8 idiag_timer;
  74. __u8 idiag_retrans;
  75. struct inet_diag_sockid id;
  76. __u32 idiag_expires;
  77. __u32 idiag_rqueue;
  78. __u32 idiag_wqueue;
  79. __u32 idiag_uid;
  80. __u32 idiag_inode;
  81. };
  82. /* Extensions */
  83. enum {
  84. INET_DIAG_NONE,
  85. INET_DIAG_MEMINFO,
  86. INET_DIAG_INFO,
  87. INET_DIAG_VEGASINFO,
  88. INET_DIAG_CONG,
  89. INET_DIAG_TOS,
  90. INET_DIAG_TCLASS,
  91. INET_DIAG_SKMEMINFO,
  92. INET_DIAG_SHUTDOWN,
  93. INET_DIAG_DCTCPINFO,
  94. INET_DIAG_PROTOCOL, /* response attribute only */
  95. INET_DIAG_SKV6ONLY,
  96. };
  97. #define INET_DIAG_MAX INET_DIAG_SKV6ONLY
  98. /* INET_DIAG_MEM */
  99. struct inet_diag_meminfo {
  100. __u32 idiag_rmem;
  101. __u32 idiag_wmem;
  102. __u32 idiag_fmem;
  103. __u32 idiag_tmem;
  104. };
  105. /* INET_DIAG_VEGASINFO */
  106. struct tcpvegas_info {
  107. __u32 tcpv_enabled;
  108. __u32 tcpv_rttcnt;
  109. __u32 tcpv_rtt;
  110. __u32 tcpv_minrtt;
  111. };
  112. /* INET_DIAG_DCTCPINFO */
  113. struct tcp_dctcp_info {
  114. __u16 dctcp_enabled;
  115. __u16 dctcp_ce_state;
  116. __u32 dctcp_alpha;
  117. __u32 dctcp_ab_ecn;
  118. __u32 dctcp_ab_tot;
  119. };
  120. union tcp_cc_info {
  121. struct tcpvegas_info vegas;
  122. struct tcp_dctcp_info dctcp;
  123. };
  124. #endif /* _UAPI_INET_DIAG_H_ */