~ubuntu-branches/ubuntu/trusty/net-snmp/trusty

« back to all changes in this revision

Viewing changes to agent/mib_modules.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-05-10 22:20:23 UTC
  • mto: (1.4.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: james.westby@ubuntu.com-20070510222023-3fr07xb9i17xvq32
Tags: upstream-5.3.1
ImportĀ upstreamĀ versionĀ 5.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
#include <winsock.h>
38
38
#endif
39
39
 
40
 
#if HAVE_DMALLOC_H
41
 
#include <dmalloc.h>
42
 
#endif
43
 
 
44
40
#include <net-snmp/net-snmp-includes.h>
45
41
#include <net-snmp/agent/net-snmp-agent-includes.h>
46
42
#include "m2m.h"
54
50
#include "mibgroup/agentx/subagent.h"
55
51
#endif
56
52
 
 
53
static int need_shutdown = 0;
 
54
 
 
55
static int
 
56
_shutdown_mib_modules(int majorID, int minorID, void *serve, void *client)
 
57
{
 
58
    if (! need_shutdown) {
 
59
        netsnmp_assert(need_shutdown == 1);
 
60
    }
 
61
    else {
 
62
#include "mib_module_shutdown.h"
 
63
 
 
64
        need_shutdown = 0;
 
65
    }
 
66
 
 
67
    return SNMPERR_SUCCESS; /* callback rc ignored */
 
68
}
57
69
 
58
70
void
59
71
init_mib_modules(void)
60
72
{
 
73
    static int once = 0;
 
74
 
61
75
#ifdef USING_IF_MIB_DATA_ACCESS_INTERFACE_MODULE
62
76
    netsnmp_access_interface_init();
63
77
#endif
64
78
#  include "mib_module_inits.h"
 
79
 
 
80
    need_shutdown = 1;
 
81
 
 
82
    if (once == 0) {
 
83
        int rc;
 
84
        once = 1;
 
85
        rc = snmp_register_callback( SNMP_CALLBACK_LIBRARY,
 
86
                                     SNMP_CALLBACK_SHUTDOWN,
 
87
                                     _shutdown_mib_modules,
 
88
                                     NULL);
 
89
 
 
90
        if( rc != SNMP_ERR_NOERROR )
 
91
            snmp_log(LOG_ERR, "error registering for SHUTDOWN callback "
 
92
                     "for mib modules\n");
 
93
    }
65
94
}