net-snmp 5.7
|
00001 /* 00002 * callback.c: A generic callback mechanism 00003 */ 00004 00005 #ifndef CALLBACK_H 00006 #define CALLBACK_H 00007 00008 #ifdef __cplusplus 00009 extern "C" { 00010 #endif 00011 00012 #define MAX_CALLBACK_IDS 2 00013 #define MAX_CALLBACK_SUBIDS 16 00014 00015 /* 00016 * Callback Major Types 00017 */ 00018 #define SNMP_CALLBACK_LIBRARY 0 00019 #define SNMP_CALLBACK_APPLICATION 1 00020 00021 /* 00022 * SNMP_CALLBACK_LIBRARY minor types 00023 */ 00024 #define SNMP_CALLBACK_POST_READ_CONFIG 0 00025 #define SNMP_CALLBACK_STORE_DATA 1 00026 #define SNMP_CALLBACK_SHUTDOWN 2 00027 #define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG 3 00028 #define SNMP_CALLBACK_LOGGING 4 00029 #define SNMP_CALLBACK_SESSION_INIT 5 00030 #define SNMP_CALLBACK_PRE_READ_CONFIG 7 00031 #define SNMP_CALLBACK_PRE_PREMIB_READ_CONFIG 8 00032 00033 00034 /* 00035 * Callback priority (lower priority numbers called first( 00036 */ 00037 #define NETSNMP_CALLBACK_HIGHEST_PRIORITY -1024 00038 #define NETSNMP_CALLBACK_DEFAULT_PRIORITY 0 00039 #define NETSNMP_CALLBACK_LOWEST_PRIORITY 1024 00040 00041 typedef int (SNMPCallback) (int majorID, int minorID, 00042 void *serverarg, void *clientarg); 00043 00044 struct snmp_gen_callback { 00045 SNMPCallback *sc_callback; 00046 void *sc_client_arg; 00047 int priority; 00048 struct snmp_gen_callback *next; 00049 }; 00050 00051 /* 00052 * function prototypes 00053 */ 00054 NETSNMP_IMPORT 00055 void init_callbacks(void); 00056 00057 NETSNMP_IMPORT 00058 int netsnmp_register_callback(int major, int minor, 00059 SNMPCallback * new_callback, 00060 void *arg, int priority); 00061 NETSNMP_IMPORT 00062 int snmp_register_callback(int major, int minor, 00063 SNMPCallback * new_callback, 00064 void *arg); 00065 NETSNMP_IMPORT 00066 int snmp_call_callbacks(int major, int minor, 00067 void *caller_arg); 00068 NETSNMP_IMPORT 00069 int snmp_callback_available(int major, int minor); /* is >1 available */ 00070 NETSNMP_IMPORT 00071 int snmp_count_callbacks(int major, int minor); /* ret the number registered */ 00072 NETSNMP_IMPORT 00073 int snmp_unregister_callback(int major, int minor, 00074 SNMPCallback * new_callback, 00075 void *arg, int matchargs); 00076 NETSNMP_IMPORT 00077 void clear_callback (void); 00078 int netsnmp_callback_clear_client_arg(void *, int i, int j); 00079 00080 struct snmp_gen_callback *snmp_callback_list(int major, int minor); 00081 00082 #ifdef __cplusplus 00083 } 00084 #endif 00085 #endif /* CALLBACK_H */