00001
00002
00003
00004
00005 #include <net-snmp/agent/mib_module_config.h>
00006 #include <net-snmp/net-snmp-config.h>
00007 #if HAVE_STRING_H
00008 #include <string.h>
00009 #else
00010 #include <strings.h>
00011 #endif
00012 #if HAVE_STDLIB_H
00013 #include <stdlib.h>
00014 #endif
00015 #if HAVE_UNISTD_H
00016 #include <unistd.h>
00017 #endif
00018 #include <sys/types.h>
00019 #if TIME_WITH_SYS_TIME
00020 # ifdef WIN32
00021 # include <sys/timeb.h>
00022 # else
00023 # include <sys/time.h>
00024 # endif
00025 # include <time.h>
00026 #else
00027 # if HAVE_SYS_TIME_H
00028 # include <sys/time.h>
00029 # else
00030 # include <time.h>
00031 # endif
00032 #endif
00033 #if HAVE_NETINET_IN_H
00034 #include <netinet/in.h>
00035 #endif
00036 #if HAVE_WINSOCK_H
00037 #include <winsock.h>
00038 #endif
00039
00040 #include <net-snmp/net-snmp-includes.h>
00041 #include <net-snmp/agent/net-snmp-agent-includes.h>
00042 #include "m2m.h"
00043 #ifdef USING_IF_MIB_DATA_ACCESS_INTERFACE_MODULE
00044 #include <net-snmp/data_access/interface.h>
00045 #endif
00046
00047 #include "mibgroup/struct.h"
00048 #include <net-snmp/agent/mib_modules.h>
00049 #include <net-snmp/agent/table.h>
00050 #include <net-snmp/agent/table_iterator.h>
00051 #include "mib_module_includes.h"
00052
00053 static int need_shutdown = 0;
00054
00055 static int
00056 _shutdown_mib_modules(int majorID, int minorID, void *serve, void *client)
00057 {
00058 if (! need_shutdown) {
00059 netsnmp_assert(need_shutdown == 1);
00060 }
00061 else {
00062 #include "mib_module_shutdown.h"
00063
00064 need_shutdown = 0;
00065 }
00066
00067 return SNMPERR_SUCCESS;
00068 }
00069
00070 void
00071 init_mib_modules(void)
00072 {
00073 static int once = 0;
00074
00075 #ifdef USING_IF_MIB_DATA_ACCESS_INTERFACE_MODULE
00076 netsnmp_access_interface_init();
00077 #endif
00078 # include "mib_module_inits.h"
00079
00080 need_shutdown = 1;
00081
00082 if (once == 0) {
00083 int rc;
00084 once = 1;
00085 rc = snmp_register_callback( SNMP_CALLBACK_LIBRARY,
00086 SNMP_CALLBACK_SHUTDOWN,
00087 _shutdown_mib_modules,
00088 NULL);
00089
00090 if( rc != SNMP_ERR_NOERROR )
00091 snmp_log(LOG_ERR, "error registering for SHUTDOWN callback "
00092 "for mib modules\n");
00093 }
00094 }