systemstats.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * systemstats data access header
  3. *
  4. * $Id$
  5. */
  6. #ifndef NETSNMP_ACCESS_SYSTEMSTATS_H
  7. #define NETSNMP_ACCESS_SYSTEMSTATS_H
  8. # ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. /**---------------------------------------------------------------------*/
  12. /*
  13. * structure definitions
  14. */
  15. /*
  16. * netsnmp_systemstats_entry
  17. */
  18. typedef struct netsnmp_systemstats_s {
  19. netsnmp_index oid_index; /* MUST BE FIRST!! for container use */
  20. /*
  21. * Index of the table
  22. * First entry = ip version
  23. * Second entry = interface index (0 for ipSystemStatsTable */
  24. oid index[2];
  25. int flags; /* for net-snmp use */
  26. /*
  27. * mib related data (considered for
  28. * netsnmp_access_systemstats_entry_update)
  29. */
  30. netsnmp_ipstats stats;
  31. /*
  32. * for logging
  33. */
  34. const char* tableName;
  35. /** old_stats is used in netsnmp_access_interface_entry_update_stats */
  36. netsnmp_ipstats *old_stats;
  37. } netsnmp_systemstats_entry;
  38. /**---------------------------------------------------------------------*/
  39. /*
  40. * ACCESS function prototypes
  41. */
  42. /*
  43. * init
  44. */
  45. void netsnmp_access_systemstats_init(void);
  46. /*
  47. * init
  48. */
  49. netsnmp_container * netsnmp_access_systemstats_container_init(u_int init_flags);
  50. #define NETSNMP_ACCESS_SYSTEMSTATS_INIT_NOFLAGS 0x0000
  51. #define NETSNMP_ACCESS_SYSTEMSTATS_INIT_ADDL_IDX_BY_ADDR 0x0001
  52. /**
  53. * Load container. If the NETSNMP_ACCESS_SYSTEMSTATS_LOAD_IFTABLE is set
  54. * the ipIfSystemStats table is loaded, else ipSystemStatsTable is loaded.
  55. */
  56. netsnmp_container*
  57. netsnmp_access_systemstats_container_load(netsnmp_container* container,
  58. u_int load_flags);
  59. #define NETSNMP_ACCESS_SYSTEMSTATS_LOAD_NOFLAGS 0x0000
  60. #define NETSNMP_ACCESS_SYSTEMSTATS_LOAD_IFTABLE 0x0001
  61. void netsnmp_access_systemstats_container_free(netsnmp_container *container,
  62. u_int free_flags);
  63. #define NETSNMP_ACCESS_SYSTEMSTATS_FREE_NOFLAGS 0x0000
  64. #define NETSNMP_ACCESS_SYSTEMSTATS_FREE_DONT_CLEAR 0x0001
  65. #define NETSNMP_ACCESS_SYSTEMSTATS_FREE_KEEP_CONTAINER 0x0002
  66. /*
  67. * create/free an entry
  68. */
  69. netsnmp_systemstats_entry *
  70. netsnmp_access_systemstats_entry_create(int version, int if_index,
  71. const char* tableName);
  72. void netsnmp_access_systemstats_entry_free(netsnmp_systemstats_entry * entry);
  73. /*
  74. * update/compare
  75. */
  76. int
  77. netsnmp_access_systemstats_entry_update(netsnmp_systemstats_entry *old,
  78. netsnmp_systemstats_entry *new_val);
  79. /**---------------------------------------------------------------------*/
  80. # ifdef __cplusplus
  81. }
  82. #endif
  83. #endif /* NETSNMP_ACCESS_SYSTEMSTATS_H */