1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
#ifndef AGENT_REGISTRY_H
#define AGENT_REGISTRY_H
/***********************************************************************/
/*
* new version2 agent handler API structures
*/
/***********************************************************************/
#include <net-snmp/agent/snmp_agent.h>
#include <net-snmp/library/fd_event_manager.h>
#ifdef __cplusplus
extern "C" {
#endif
/***********************************************************************/
/*
* requests api definitions
*/
/***********************************************************************/
/*
* the structure of parameters passed to registered ACM modules
*/
struct view_parameters {
netsnmp_pdu *pdu;
oid *name;
size_t namelen;
int test;
int errorcode; /* Do not change unless you're
specifying an error, as it starts
in a success state. */
int check_subtree;
};
struct register_parameters {
oid *name;
size_t namelen;
int priority;
int range_subid;
oid range_ubound;
int timeout;
u_char flags;
const char *contextName;
netsnmp_session *session;
netsnmp_handler_registration *reginfo;
};
typedef struct subtree_context_cache_s {
const char *context_name;
struct netsnmp_subtree_s *first_subtree;
struct subtree_context_cache_s *next;
} subtree_context_cache;
void setup_tree (void);
void shutdown_tree (void);
netsnmp_subtree *netsnmp_subtree_find (const oid *, size_t,
netsnmp_subtree *,
const char *context_name);
netsnmp_subtree *netsnmp_subtree_find_next(const oid *, size_t,
netsnmp_subtree *,
const char *context_name);
netsnmp_subtree *netsnmp_subtree_find_prev(const oid *, size_t,
netsnmp_subtree *,
const char *context_name);
netsnmp_subtree *netsnmp_subtree_find_first(const char *context_name);
netsnmp_session *get_session_for_oid (const oid *, size_t,
const char *context_name);
subtree_context_cache *get_top_context_cache(void);
void netsnmp_set_lookup_cache_size(int newsize);
int netsnmp_get_lookup_cache_size(void);
#define MIB_REGISTERED_OK 0
#define MIB_DUPLICATE_REGISTRATION -1
#define MIB_REGISTRATION_FAILED -2
#define MIB_UNREGISTERED_OK 0
#define MIB_NO_SUCH_REGISTRATION -1
#define MIB_UNREGISTRATION_FAILED -2
#define DEFAULT_MIB_PRIORITY 127
int register_mib (const char *, struct variable *,
size_t, size_t, const oid *,
size_t);
int register_mib_priority (const char *, struct variable *,
size_t, size_t, const oid *, size_t,
int);
int register_mib_range (const char *, struct variable *,
size_t, size_t, const oid *,
size_t, int, int, oid,
netsnmp_session *);
int register_mib_context (const char *, struct variable *,
size_t, size_t, const oid *, size_t,
int, int, oid, netsnmp_session *,
const char *, int, int);
int netsnmp_register_mib_table_row (const char *, struct variable *,
size_t, size_t, oid *,
size_t, int, int, netsnmp_session *,
const char *, int, int);
int unregister_mib (oid *, size_t);
int unregister_mib_priority (oid *, size_t, int);
int unregister_mib_range (oid *, size_t, int, int, oid);
int unregister_mib_context (oid *, size_t, int, int, oid,
const char *);
void clear_context (void);
void unregister_mibs_by_session (netsnmp_session *);
int netsnmp_unregister_mib_table_row (oid *mibloc, size_t mibloclen,
int priority, int var_subid,
oid range_ubound,
const char *context);
int compare_tree (const oid *, size_t,
const oid *, size_t);
int in_a_view (oid *, size_t *,
netsnmp_pdu *, int);
int check_access (netsnmp_pdu *pdu);
int netsnmp_acm_check_subtree (netsnmp_pdu *, oid *, size_t);
void register_mib_reattach (void);
void register_mib_detach (void);
/*
* REGISTER_MIB(): This macro simply loads register_mib with less pain:
*
* descr: A short description of the mib group being loaded.
* var: The variable structure to load.
* vartype: The variable structure used to define it (variable[2, 4, ...])
* theoid: An *initialized* *exact length* oid pointer.
* (sizeof(theoid) *must* return the number of elements!)
*/
#define REGISTER_MIB(descr, var, vartype, theoid) \
if (register_mib(descr, (struct variable *) var, sizeof(struct vartype), \
sizeof(var)/sizeof(struct vartype), \
theoid, sizeof(theoid)/sizeof(oid)) != MIB_REGISTERED_OK ) \
DEBUGMSGTL(("register_mib", "%s registration failed\n", descr));
#define NUM_EXTERNAL_SIGS 32
#define SIG_REGISTERED_OK 0
#define SIG_REGISTRATION_FAILED -2
#define SIG_UNREGISTERED_OK 0
extern int external_signal_scheduled[NUM_EXTERNAL_SIGS];
extern void (*external_signal_handler[NUM_EXTERNAL_SIGS])(int);
int register_signal(int, void (*func)(int));
int unregister_signal(int);
/*
* internal API. Don't use this. Use netsnmp_register_handler instead
*/
struct netsnmp_handler_registration_s;
int netsnmp_register_mib(const char *, struct variable *,
size_t, size_t, oid *, size_t,
int, int, oid, netsnmp_session *,
const char *, int, int,
struct netsnmp_handler_registration_s *,
int);
#ifdef __cplusplus
}
#endif
#endif /* AGENT_REGISTRY_H */
|