tcpConn.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * tcpConn data access header
  3. *
  4. * $Id$
  5. */
  6. #ifndef NETSNMP_ACCESS_TCPCONN_H
  7. #define NETSNMP_ACCESS_TCPCONN_H
  8. /** need def of NETSNMP_ACCESS_IPADDRESS_BUF_SIZE */
  9. #include <net-snmp/data_access/ipaddress.h>
  10. # ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. /**---------------------------------------------------------------------*/
  14. /*
  15. * structure definitions
  16. */
  17. /*
  18. * netsnmp_tcpconn_entry
  19. * - primary tcpconn structure for both ipv4 & ipv6
  20. */
  21. typedef struct netsnmp_tcpconn_s {
  22. netsnmp_index oid_index; /* MUST BE FIRST!! for container use */
  23. oid arbitrary_index; /* arbitrary index */
  24. int flags; /* for net-snmp use */
  25. u_char loc_addr[NETSNMP_ACCESS_IPADDRESS_BUF_SIZE];
  26. u_char rmt_addr[NETSNMP_ACCESS_IPADDRESS_BUF_SIZE];
  27. u_char loc_addr_len;/* address len, 4 | 16 */
  28. u_char rmt_addr_len;/* address len, 4 | 16 */
  29. u_short loc_port;
  30. u_short rmt_port;
  31. /*
  32. * mib related data (considered for
  33. * netsnmp_access_tcpconn_entry_update)
  34. */
  35. /*
  36. * tcpconnState(1)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
  37. */
  38. u_int tcpConnState; /* 1-12 */
  39. u_int pid;
  40. netsnmp_data_list *arch_data; /* arch specific data */
  41. } netsnmp_tcpconn_entry;
  42. /**---------------------------------------------------------------------*/
  43. /*
  44. * ACCESS function prototypes
  45. */
  46. /*
  47. * ifcontainer init
  48. */
  49. netsnmp_container * netsnmp_access_tcpconn_container_init(u_int init_flags);
  50. #define NETSNMP_ACCESS_TCPCONN_INIT_NOFLAGS 0x0000
  51. /*
  52. * ifcontainer load and free
  53. */
  54. netsnmp_container*
  55. netsnmp_access_tcpconn_container_load(netsnmp_container* container,
  56. u_int load_flags);
  57. #define NETSNMP_ACCESS_TCPCONN_LOAD_NOFLAGS 0x0000
  58. #define NETSNMP_ACCESS_TCPCONN_LOAD_NOLISTEN 0x0001
  59. #define NETSNMP_ACCESS_TCPCONN_LOAD_ONLYLISTEN 0x0002
  60. #define NETSNMP_ACCESS_TCPCONN_LOAD_IPV4_ONLY 0x0004
  61. void netsnmp_access_tcpconn_container_free(netsnmp_container *container,
  62. u_int free_flags);
  63. #define NETSNMP_ACCESS_TCPCONN_FREE_NOFLAGS 0x0000
  64. #define NETSNMP_ACCESS_TCPCONN_FREE_DONT_CLEAR 0x0001
  65. #define NETSNMP_ACCESS_TCPCONN_FREE_KEEP_CONTAINER 0x0002
  66. /*
  67. * create/free a tcpconn entry
  68. */
  69. netsnmp_tcpconn_entry *
  70. netsnmp_access_tcpconn_entry_create(void);
  71. void netsnmp_access_tcpconn_entry_free(netsnmp_tcpconn_entry * entry);
  72. /*
  73. * update/compare
  74. */
  75. int
  76. netsnmp_access_tcpconn_entry_update(netsnmp_tcpconn_entry *old,
  77. netsnmp_tcpconn_entry *new_val);
  78. /*
  79. * find entry in container
  80. */
  81. /** not yet */
  82. /*
  83. * create/change/delete
  84. */
  85. int
  86. netsnmp_access_tcpconn_entry_set(netsnmp_tcpconn_entry * entry);
  87. /*
  88. * tcpconn flags
  89. * upper bits for internal use
  90. * lower bits indicate changed fields. see FLAG_TCPCONN* definitions in
  91. * tcpConnTable_constants.h
  92. */
  93. #define NETSNMP_ACCESS_TCPCONN_CREATE 0x80000000
  94. #define NETSNMP_ACCESS_TCPCONN_DELETE 0x40000000
  95. #define NETSNMP_ACCESS_TCPCONN_CHANGE 0x20000000
  96. /**---------------------------------------------------------------------*/
  97. # ifdef __cplusplus
  98. }
  99. #endif
  100. #endif /* NETSNMP_ACCESS_TCPCONN_H */