inet_diag.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #ifndef _INET_DIAG_H_
  2. #define _INET_DIAG_H_ 1
  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. enum {
  29. INET_DIAG_REQ_NONE,
  30. INET_DIAG_REQ_BYTECODE,
  31. };
  32. #define INET_DIAG_REQ_MAX INET_DIAG_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 inet_diag_bc_op {
  39. unsigned char code;
  40. unsigned char yes;
  41. unsigned short no;
  42. };
  43. enum {
  44. INET_DIAG_BC_NOP,
  45. INET_DIAG_BC_JMP,
  46. INET_DIAG_BC_S_GE,
  47. INET_DIAG_BC_S_LE,
  48. INET_DIAG_BC_D_GE,
  49. INET_DIAG_BC_D_LE,
  50. INET_DIAG_BC_AUTO,
  51. INET_DIAG_BC_S_COND,
  52. INET_DIAG_BC_D_COND,
  53. };
  54. struct inet_diag_hostcond {
  55. __u8 family;
  56. __u8 prefix_len;
  57. int port;
  58. __be32 addr[0];
  59. };
  60. /* Base info structure. It contains socket identity (addrs/ports/cookie)
  61. * and, alas, the information shown by netstat. */
  62. struct inet_diag_msg {
  63. __u8 idiag_family;
  64. __u8 idiag_state;
  65. __u8 idiag_timer;
  66. __u8 idiag_retrans;
  67. struct inet_diag_sockid id;
  68. __u32 idiag_expires;
  69. __u32 idiag_rqueue;
  70. __u32 idiag_wqueue;
  71. __u32 idiag_uid;
  72. __u32 idiag_inode;
  73. };
  74. /* Extensions */
  75. enum {
  76. INET_DIAG_NONE,
  77. INET_DIAG_MEMINFO,
  78. INET_DIAG_INFO,
  79. INET_DIAG_VEGASINFO,
  80. INET_DIAG_CONG,
  81. INET_DIAG_TOS,
  82. INET_DIAG_TCLASS,
  83. };
  84. #define INET_DIAG_MAX INET_DIAG_TCLASS
  85. /* INET_DIAG_MEM */
  86. struct inet_diag_meminfo {
  87. __u32 idiag_rmem;
  88. __u32 idiag_wmem;
  89. __u32 idiag_fmem;
  90. __u32 idiag_tmem;
  91. };
  92. /* INET_DIAG_VEGASINFO */
  93. struct tcpvegas_info {
  94. __u32 tcpv_enabled;
  95. __u32 tcpv_rttcnt;
  96. __u32 tcpv_rtt;
  97. __u32 tcpv_minrtt;
  98. };
  99. #ifdef __KERNEL__
  100. struct sock;
  101. struct inet_hashinfo;
  102. struct inet_diag_handler {
  103. struct inet_hashinfo *idiag_hashinfo;
  104. void (*idiag_get_info)(struct sock *sk,
  105. struct inet_diag_msg *r,
  106. void *info);
  107. __u16 idiag_info_size;
  108. __u16 idiag_type;
  109. };
  110. extern int inet_diag_register(const struct inet_diag_handler *handler);
  111. extern void inet_diag_unregister(const struct inet_diag_handler *handler);
  112. #endif /* __KERNEL__ */
  113. #endif /* _INET_DIAG_H_ */