tcp_diag.h 2.1 KB

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