net-snmp 5.7
|
00001 /* 00002 * watcher.h 00003 */ 00004 #ifndef NETSNMP_WATCHER_H 00005 #define NETSNMP_WATCHER_H 00006 00007 #ifdef __cplusplus 00008 extern "C" { 00009 #endif 00010 00015 /* 00016 * if handler flag has this bit set, the timestamp will be 00017 * treated as a pointer to the timestamp. If this bit is 00018 * not set (the default), the timestamp is a struct timeval 00019 * that must be compared to the agent starttime. 00020 */ 00021 #define NETSNMP_WATCHER_DIRECT MIB_HANDLER_CUSTOM1 00022 00026 #define WATCHER_FIXED_SIZE 0x01 00027 00032 #define WATCHER_MAX_SIZE 0x02 00033 00038 #define WATCHER_SIZE_IS_PTR 0x04 00039 00045 #define WATCHER_SIZE_STRLEN 0x08 00046 00052 #define WATCHER_SIZE_UNIT_OIDS 0x10 00053 00054 typedef struct netsnmp_watcher_info_s { 00055 void *data; 00056 size_t data_size; 00057 size_t max_size; 00058 u_char type; 00059 int flags; 00060 size_t *data_size_p; 00061 } netsnmp_watcher_info; 00062 00065 int netsnmp_register_watched_instance( netsnmp_handler_registration *reginfo, 00066 netsnmp_watcher_info *winfo); 00067 int netsnmp_register_watched_instance2(netsnmp_handler_registration *reginfo, 00068 netsnmp_watcher_info *winfo); 00069 int netsnmp_register_watched_scalar( netsnmp_handler_registration *reginfo, 00070 netsnmp_watcher_info *winfo); 00071 int netsnmp_register_watched_scalar2( netsnmp_handler_registration *reginfo, 00072 netsnmp_watcher_info *winfo); 00073 int netsnmp_register_watched_timestamp(netsnmp_handler_registration *reginfo, 00074 marker_t timestamp); 00075 int netsnmp_watched_timestamp_register(netsnmp_mib_handler *whandler, 00076 netsnmp_handler_registration *reginfo, 00077 marker_t timestamp); 00078 int netsnmp_register_watched_spinlock(netsnmp_handler_registration *reginfo, 00079 int *spinlock); 00080 00081 /* 00082 * Convenience registration calls 00083 */ 00084 00085 int netsnmp_register_ulong_scalar(const char *name, 00086 const oid * reg_oid, size_t reg_oid_len, 00087 u_long * it, 00088 Netsnmp_Node_Handler * subhandler); 00089 int netsnmp_register_read_only_ulong_scalar(const char *name, 00090 const oid * reg_oid, size_t reg_oid_len, 00091 u_long * it, 00092 Netsnmp_Node_Handler * subhandler); 00093 int netsnmp_register_long_scalar(const char *name, 00094 const oid * reg_oid, size_t reg_oid_len, 00095 long * it, 00096 Netsnmp_Node_Handler * subhandler); 00097 int netsnmp_register_read_only_long_scalar(const char *name, 00098 const oid * reg_oid, size_t reg_oid_len, 00099 long * it, 00100 Netsnmp_Node_Handler * subhandler); 00101 int netsnmp_register_int_scalar(const char *name, 00102 const oid * reg_oid, size_t reg_oid_len, 00103 int * it, 00104 Netsnmp_Node_Handler * subhandler); 00105 int netsnmp_register_read_only_int_scalar(const char *name, 00106 const oid * reg_oid, size_t reg_oid_len, 00107 int * it, 00108 Netsnmp_Node_Handler * subhandler); 00109 int netsnmp_register_read_only_counter32_scalar(const char *name, 00110 const oid * reg_oid, size_t reg_oid_len, 00111 u_long * it, 00112 Netsnmp_Node_Handler * subhandler); 00113 00114 #define WATCHER_HANDLER_NAME "watcher" 00115 00116 netsnmp_mib_handler *netsnmp_get_watcher_handler(void); 00117 00118 netsnmp_watcher_info * 00119 netsnmp_init_watcher_info(netsnmp_watcher_info *, void *, size_t, u_char, int); 00120 00121 netsnmp_watcher_info * 00122 netsnmp_init_watcher_info6(netsnmp_watcher_info *, 00123 void *, size_t, u_char, int, size_t, size_t*); 00124 00125 netsnmp_watcher_info * 00126 netsnmp_create_watcher_info(void *, size_t, u_char, int); 00127 00128 netsnmp_watcher_info * 00129 netsnmp_create_watcher_info6(void *, size_t, u_char, int, size_t, size_t*); 00130 00131 netsnmp_watcher_info * 00132 netsnmp_clone_watcher_info(netsnmp_watcher_info *winfo); 00133 void 00134 netsnmp_owns_watcher_info(netsnmp_mib_handler *handler); 00135 00136 Netsnmp_Node_Handler netsnmp_watcher_helper_handler; 00137 00138 netsnmp_mib_handler *netsnmp_get_watched_timestamp_handler(void); 00139 Netsnmp_Node_Handler netsnmp_watched_timestamp_handler; 00140 00141 netsnmp_mib_handler *netsnmp_get_watched_spinlock_handler(void); 00142 Netsnmp_Node_Handler netsnmp_watched_spinlock_handler; 00143 00144 #ifdef __cplusplus 00145 } 00146 #endif 00147 00148 #endif