diff options
author | Hideki Yamane <henrich@debian.org> | 2013-04-11 10:21:22 +0900 |
---|---|---|
committer | Hideki Yamane <henrich@debian.org> | 2013-04-11 10:21:22 +0900 |
commit | e30beeedd5cbe6f72008c32122b3b8b617fd5ab2 (patch) | |
tree | 8bd5c28fc77a5a80d65cf70e2fd330b8af448c73 /agent/mib_modules.c | |
parent | 2ebfa94e6e1fe2b88bb061d26f20fef9c0b78536 (diff) | |
download | pkg-net-snmp-e30beeedd5cbe6f72008c32122b3b8b617fd5ab2.tar.gz |
Imported Upstream version 5.4.3~dfsgupstream/5.4.3_dfsg
Diffstat (limited to 'agent/mib_modules.c')
-rw-r--r-- | agent/mib_modules.c | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/agent/mib_modules.c b/agent/mib_modules.c new file mode 100644 index 0000000..95e4695 --- /dev/null +++ b/agent/mib_modules.c @@ -0,0 +1,97 @@ +/* + * wrapper to call all the mib module initialization functions + */ + +#include <net-snmp/agent/mib_module_config.h> +#include <net-snmp/net-snmp-config.h> +#if HAVE_STRING_H +#include <string.h> +#else +#include <strings.h> +#endif +#if HAVE_STDLIB_H +#include <stdlib.h> +#endif +#if HAVE_UNISTD_H +#include <unistd.h> +#endif +#include <sys/types.h> +#if TIME_WITH_SYS_TIME +# ifdef WIN32 +# include <sys/timeb.h> +# else +# include <sys/time.h> +# endif +# include <time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif +#if HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +#if HAVE_WINSOCK_H +#include <winsock.h> +#endif + +#include <net-snmp/net-snmp-includes.h> +#include <net-snmp/agent/net-snmp-agent-includes.h> +#include "m2m.h" +#ifdef USING_IF_MIB_DATA_ACCESS_INTERFACE_MODULE +#include <net-snmp/data_access/interface.h> +#endif + +#include "mibgroup/struct.h" +#include <net-snmp/agent/mib_modules.h> +#include <net-snmp/agent/table.h> +#include <net-snmp/agent/table_iterator.h> +#include "mib_module_includes.h" +#ifdef USING_AGENTX_SUBAGENT_MODULE +#include "mibgroup/agentx/subagent.h" +#endif + +static int need_shutdown = 0; + +static int +_shutdown_mib_modules(int majorID, int minorID, void *serve, void *client) +{ + if (! need_shutdown) { + netsnmp_assert(need_shutdown == 1); + } + else { +#include "mib_module_shutdown.h" + + need_shutdown = 0; + } + + return SNMPERR_SUCCESS; /* callback rc ignored */ +} + +void +init_mib_modules(void) +{ + static int once = 0; + +#ifdef USING_IF_MIB_DATA_ACCESS_INTERFACE_MODULE + netsnmp_access_interface_init(); +#endif +# include "mib_module_inits.h" + + need_shutdown = 1; + + if (once == 0) { + int rc; + once = 1; + rc = snmp_register_callback( SNMP_CALLBACK_LIBRARY, + SNMP_CALLBACK_SHUTDOWN, + _shutdown_mib_modules, + NULL); + + if( rc != SNMP_ERR_NOERROR ) + snmp_log(LOG_ERR, "error registering for SHUTDOWN callback " + "for mib modules\n"); + } +} |