Blame agent/mib_modules.c
|
Packit Service |
b38f0b |
/*
|
|
Packit Service |
b38f0b |
* wrapper to call all the mib module initialization functions
|
|
Packit Service |
b38f0b |
*/
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
#include <net-snmp/agent/mib_module_config.h>
|
|
Packit Service |
b38f0b |
#include <net-snmp/net-snmp-config.h>
|
|
Packit Service |
b38f0b |
#if HAVE_STRING_H
|
|
Packit Service |
b38f0b |
#include <string.h>
|
|
Packit Service |
b38f0b |
#else
|
|
Packit Service |
b38f0b |
#include <strings.h>
|
|
Packit Service |
b38f0b |
#endif
|
|
Packit Service |
b38f0b |
#if HAVE_STDLIB_H
|
|
Packit Service |
b38f0b |
#include <stdlib.h>
|
|
Packit Service |
b38f0b |
#endif
|
|
Packit Service |
b38f0b |
#if HAVE_UNISTD_H
|
|
Packit Service |
b38f0b |
#include <unistd.h>
|
|
Packit Service |
b38f0b |
#endif
|
|
Packit Service |
b38f0b |
#include <sys/types.h>
|
|
Packit Service |
b38f0b |
#if TIME_WITH_SYS_TIME
|
|
Packit Service |
b38f0b |
# include <sys/time.h>
|
|
Packit Service |
b38f0b |
# include <time.h>
|
|
Packit Service |
b38f0b |
#else
|
|
Packit Service |
b38f0b |
# if HAVE_SYS_TIME_H
|
|
Packit Service |
b38f0b |
# include <sys/time.h>
|
|
Packit Service |
b38f0b |
# else
|
|
Packit Service |
b38f0b |
# include <time.h>
|
|
Packit Service |
b38f0b |
# endif
|
|
Packit Service |
b38f0b |
#endif
|
|
Packit Service |
b38f0b |
#if HAVE_NETINET_IN_H
|
|
Packit Service |
b38f0b |
#include <netinet/in.h>
|
|
Packit Service |
b38f0b |
#endif
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
#include <net-snmp/net-snmp-includes.h>
|
|
Packit Service |
b38f0b |
#include <net-snmp/agent/net-snmp-agent-includes.h>
|
|
Packit Service |
b38f0b |
#include "m2m.h"
|
|
Packit Service |
b38f0b |
#ifdef USING_IF_MIB_DATA_ACCESS_INTERFACE_MODULE
|
|
Packit Service |
b38f0b |
#include <net-snmp/data_access/interface.h>
|
|
Packit Service |
b38f0b |
#endif
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
#include "mibgroup/struct.h"
|
|
Packit Service |
b38f0b |
#include <net-snmp/agent/mib_modules.h>
|
|
Packit Service |
b38f0b |
#include <net-snmp/agent/table.h>
|
|
Packit Service |
b38f0b |
#include <net-snmp/agent/table_iterator.h>
|
|
Packit Service |
b38f0b |
#include "mib_module_includes.h"
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
static int need_shutdown = 0;
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
static int
|
|
Packit Service |
b38f0b |
_shutdown_mib_modules(int majorID, int minorID, void *serve, void *client)
|
|
Packit Service |
b38f0b |
{
|
|
Packit Service |
b38f0b |
if (! need_shutdown) {
|
|
Packit Service |
b38f0b |
netsnmp_assert(need_shutdown == 1);
|
|
Packit Service |
b38f0b |
}
|
|
Packit Service |
b38f0b |
else {
|
|
Packit Service |
b38f0b |
#include "mib_module_shutdown.h"
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
need_shutdown = 0;
|
|
Packit Service |
b38f0b |
}
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
return SNMPERR_SUCCESS; /* callback rc ignored */
|
|
Packit Service |
b38f0b |
}
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
void
|
|
Packit Service |
b38f0b |
init_mib_modules(void)
|
|
Packit Service |
b38f0b |
{
|
|
Packit Service |
b38f0b |
static int once = 0;
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
#ifdef USING_IF_MIB_DATA_ACCESS_INTERFACE_MODULE
|
|
Packit Service |
b38f0b |
netsnmp_access_interface_init();
|
|
Packit Service |
b38f0b |
#endif
|
|
Packit Service |
b38f0b |
# include "mib_module_inits.h"
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
need_shutdown = 1;
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
if (once == 0) {
|
|
Packit Service |
b38f0b |
int rc;
|
|
Packit Service |
b38f0b |
once = 1;
|
|
Packit Service |
b38f0b |
rc = snmp_register_callback( SNMP_CALLBACK_LIBRARY,
|
|
Packit Service |
b38f0b |
SNMP_CALLBACK_SHUTDOWN,
|
|
Packit Service |
b38f0b |
_shutdown_mib_modules,
|
|
Packit Service |
b38f0b |
NULL);
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
if( rc != SNMP_ERR_NOERROR )
|
|
Packit Service |
b38f0b |
snmp_log(LOG_ERR, "error registering for SHUTDOWN callback "
|
|
Packit Service |
b38f0b |
"for mib modules\n");
|
|
Packit Service |
b38f0b |
}
|
|
Packit Service |
b38f0b |
}
|