fix outgoing QOS prios
[tomato.git] / release / src / router / snmp / agent / mib_modules.c
blobdbae510b7081cf1272e767490ec24b768d873429
1 /*
2 * wrapper to call all the mib module initialization functions
3 */
5 #include <net-snmp/agent/mib_module_config.h>
6 #include <net-snmp/net-snmp-config.h>
7 #if HAVE_STRING_H
8 #include <string.h>
9 #else
10 #include <strings.h>
11 #endif
12 #if HAVE_STDLIB_H
13 #include <stdlib.h>
14 #endif
15 #if HAVE_UNISTD_H
16 #include <unistd.h>
17 #endif
18 #include <sys/types.h>
19 #if TIME_WITH_SYS_TIME
20 # ifdef WIN32
21 # include <sys/timeb.h>
22 # else
23 # include <sys/time.h>
24 # endif
25 # include <time.h>
26 #else
27 # if HAVE_SYS_TIME_H
28 # include <sys/time.h>
29 # else
30 # include <time.h>
31 # endif
32 #endif
33 #if HAVE_NETINET_IN_H
34 #include <netinet/in.h>
35 #endif
36 #if HAVE_WINSOCK_H
37 #include <winsock.h>
38 #endif
40 #if HAVE_DMALLOC_H
41 #include <dmalloc.h>
42 #endif
44 #include <net-snmp/net-snmp-includes.h>
45 #include <net-snmp/agent/net-snmp-agent-includes.h>
46 #include "m2m.h"
48 #include "mibgroup/struct.h"
49 #include <net-snmp/agent/mib_modules.h>
50 #include <net-snmp/agent/table.h>
51 #include <net-snmp/agent/table_iterator.h>
52 #include "mib_module_includes.h"
53 #ifdef USING_AGENTX_SUBAGENT_MODULE
54 #include "mibgroup/agentx/subagent.h"
55 #endif
57 struct module_init_list *initlist = NULL;
58 struct module_init_list *noinitlist = NULL;
61 void
62 add_to_init_list(char *module_list)
64 struct module_init_list *newitem, **list;
65 char *cp;
67 if (module_list == NULL) {
68 return;
69 } else {
70 cp = (char *) module_list;
73 if (*cp == '-' || *cp == '!') {
74 cp++;
75 list = &noinitlist;
76 } else {
77 list = &initlist;
80 cp = strtok(cp, ", :");
81 while (cp) {
82 newitem = (struct module_init_list *) calloc(1, sizeof(*initlist));
83 newitem->module_name = strdup(cp);
84 newitem->next = *list;
85 *list = newitem;
86 cp = strtok(NULL, ", :");
90 int
91 should_init(const char *module_name)
93 struct module_init_list *listp;
96 * a definitive list takes priority
98 if (initlist) {
99 listp = initlist;
100 while (listp) {
101 if (strcmp(listp->module_name, module_name) == 0) {
102 DEBUGMSGTL(("mib_init", "initializing: %s\n",
103 module_name));
104 return DO_INITIALIZE;
106 listp = listp->next;
108 DEBUGMSGTL(("mib_init", "skipping: %s\n", module_name));
109 return DONT_INITIALIZE;
113 * initialize it only if not on the bad list (bad module, no bone)
115 if (noinitlist) {
116 listp = noinitlist;
117 while (listp) {
118 if (strcmp(listp->module_name, module_name) == 0) {
119 DEBUGMSGTL(("mib_init", "skipping: %s\n",
120 module_name));
121 return DONT_INITIALIZE;
123 listp = listp->next;
126 DEBUGMSGTL(("mib_init", "initializing: %s\n", module_name));
129 * initialize it
131 return DO_INITIALIZE;
134 void
135 init_mib_modules(void)
137 # include "mib_module_inits.h"