tcp_diag.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #ifndef _TCP_DIAG_H_
  2. #define _TCP_DIAG_H_ 1
  3. /* Just some random number */
  4. #define TCPDIAG_GETSOCK 18
  5. /* Socket identity */
  6. struct tcpdiag_sockid
  7. {
  8. __u16 tcpdiag_sport;
  9. __u16 tcpdiag_dport;
  10. __u32 tcpdiag_src[4];
  11. __u32 tcpdiag_dst[4];
  12. __u32 tcpdiag_if;
  13. __u32 tcpdiag_cookie[2];
  14. #define TCPDIAG_NOCOOKIE (~0U)
  15. };
  16. /* Request structure */
  17. struct tcpdiagreq
  18. {
  19. __u8 tcpdiag_family; /* Family of addresses. */
  20. __u8 tcpdiag_src_len;
  21. __u8 tcpdiag_dst_len;
  22. __u8 tcpdiag_ext; /* Query extended information */
  23. struct tcpdiag_sockid id;
  24. __u32 tcpdiag_states; /* States to dump */
  25. __u32 tcpdiag_dbs; /* Tables to dump (NI) */
  26. };
  27. enum
  28. {
  29. TCPDIAG_REQ_NONE,
  30. TCPDIAG_REQ_BYTECODE,
  31. };
  32. #define TCPDIAG_REQ_MAX TCPDIAG_REQ_BYTECODE
  33. /* Bytecode is sequence of 4 byte commands followed by variable arguments.
  34. * All the commands identified by "code" are conditional jumps forward:
  35. * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
  36. * length of the command and its arguments.
  37. */
  38. struct tcpdiag_bc_op
  39. {
  40. unsigned char code;
  41. unsigned char yes;
  42. unsigned short no;
  43. };
  44. enum
  45. {
  46. TCPDIAG_BC_NOP,
  47. TCPDIAG_BC_JMP,
  48. TCPDIAG_BC_S_GE,
  49. TCPDIAG_BC_S_LE,
  50. TCPDIAG_BC_D_GE,
  51. TCPDIAG_BC_D_LE,
  52. TCPDIAG_BC_AUTO,
  53. TCPDIAG_BC_S_COND,
  54. TCPDIAG_BC_D_COND,
  55. };
  56. struct tcpdiag_hostcond
  57. {
  58. __u8 family;
  59. __u8 prefix_len;
  60. int port;
  61. __u32 addr[0];
  62. };
  63. /* Base info structure. It contains socket identity (addrs/ports/cookie)
  64. * and, alas, the information shown by netstat. */
  65. struct tcpdiagmsg
  66. {
  67. __u8 tcpdiag_family;
  68. __u8 tcpdiag_state;
  69. __u8 tcpdiag_timer;
  70. __u8 tcpdiag_retrans;
  71. struct tcpdiag_sockid id;
  72. __u32 tcpdiag_expires;
  73. __u32 tcpdiag_rqueue;
  74. __u32 tcpdiag_wqueue;
  75. __u32 tcpdiag_uid;
  76. __u32 tcpdiag_inode;
  77. };
  78. /* Extensions */
  79. enum
  80. {
  81. TCPDIAG_NONE,
  82. TCPDIAG_MEMINFO,
  83. TCPDIAG_INFO,
  84. TCPDIAG_VEGASINFO,
  85. TCPDIAG_CONG,
  86. };
  87. #define TCPDIAG_MAX TCPDIAG_CONG
  88. /* TCPDIAG_MEM */
  89. struct tcpdiag_meminfo
  90. {
  91. __u32 tcpdiag_rmem;
  92. __u32 tcpdiag_wmem;
  93. __u32 tcpdiag_fmem;
  94. __u32 tcpdiag_tmem;
  95. };
  96. /* TCPDIAG_VEGASINFO */
  97. struct tcpvegas_info {
  98. __u32 tcpv_enabled;
  99. __u32 tcpv_rttcnt;
  100. __u32 tcpv_rtt;
  101. __u32 tcpv_minrtt;
  102. };
  103. #endif /* _TCP_DIAG_H_ */