1Net-SNMP Agent handler and extenNseitb-inSleNitMt-PysnAAmgPpeIn(t3)handler and extensibility API(3)
2
3
4
6 Net-SNMP Agent handler and extensibility API - The basic theory goes
7 something like this: In the past, with the original mib module api
8 (which derived from the original CMU SNMP code) the underlying mib
9 modules were passed very little information (only the truly most basic
10 information about a request).
11
12
13 Modules
14 utility_handlers
15 Simplify request processing A group of handlers intended to
16 simplify certain aspects of processing a request for a MIB object.
17
18 leaf_handlers
19 Process individual leaf objects A group of handlers to implement
20 individual leaf objects and instances (both scalar objects, and
21 individual objects and instances within a table).
22
23 baby_steps
24 Calls your handler in baby_steps for set processing.
25
26 old_api
27 Calls mib module code written in the old style of code.
28
29 stash_cache
30 Automatically caches data for certain handlers.
31
32 table
33 Helps you implement a table.
34
35 Data Structures
36 struct netsnmp_mib_handler_s
37 the mib handler structure to be registered
38 struct netsnmp_handler_registration_s
39 Root registration info.
40 struct netsnmp_handler_args_s
41 struct netsnmp_delegated_cache_s
42 struct netsnmp_mib_handler_s
43 the mib handler structure to be registered
44 struct netsnmp_handler_registration_s
45 Root registration info.
46
47 Defines
48 #define MIB_HANDLER_AUTO_NEXT 0x00000001
49 #define MIB_HANDLER_AUTO_NEXT_OVERRIDE_ONCE 0x00000002
50 #define MIB_HANDLER_INSTANCE 0x00000004
51 #define MIB_HANDLER_CUSTOM4 0x10000000
52 #define MIB_HANDLER_CUSTOM3 0x20000000
53 #define MIB_HANDLER_CUSTOM2 0x40000000
54 #define MIB_HANDLER_CUSTOM1 0x80000000
55 #define HANDLER_CAN_GETANDGETNEXT 0x01
56 #define HANDLER_CAN_SET 0x02
57 #define HANDLER_CAN_GETBULK 0x04
58 #define HANDLER_CAN_NOT_CREATE 0x08
59 #define HANDLER_CAN_BABY_STEP 0x10
60 #define HANDLER_CAN_STASH 0x20
61 #define HANDLER_CAN_RONLY (HANDLER_CAN_GETANDGETNEXT)
62 #define HANDLER_CAN_RWRITE (HANDLER_CAN_GETANDGETNEXT |
63 HANDLER_CAN_SET)
64 #define HANDLER_CAN_SET_ONLY (HANDLER_CAN_SET |
65 HANDLER_CAN_NOT_CREATE)
66 #define HANDLER_CAN_DEFAULT (HANDLER_CAN_RONLY |
67 HANDLER_CAN_NOT_CREATE)
68 #define REQUEST_IS_DELEGATED 1
69 #define REQUEST_IS_NOT_DELEGATED 0
70
71 Typedefs
72 typedef netsnmp_mib_handler_s netsnmp_mib_handler
73 Typedefs the netsnmp_mib_handler_s struct into netsnmp_mib_handler.
74 typedef netsnmp_handler_registration_s netsnmp_handler_registration
75 Typedefs the netsnmp_handler_registration_s struct into
76 netsnmp_handler_registration.
77 typedef int() Netsnmp_Node_Handler (netsnmp_mib_handler *handler,
78 netsnmp_handler_registration *reginfo, netsnmp_agent_request_info
79 *reqinfo, netsnmp_request_info *requests)
80 typedef netsnmp_handler_args_s netsnmp_handler_args
81 typedef netsnmp_delegated_cache_s netsnmp_delegated_cache
82
83 Functions
84 netsnmp_mib_handler * netsnmp_create_handler (const char *name,
85 Netsnmp_Node_Handler *handler_access_method)
86 creates a netsnmp_mib_handler structure given a name and a access
87 method.
88 netsnmp_handler_registration * netsnmp_handler_registration_create
89 (const char *name, netsnmp_mib_handler *handler, oid *reg_oid,
90 size_t reg_oid_len, int modes)
91 creates a handler registration structure given a name, a
92 access_method function, a registration location oid and the modes
93 the handler supports.
94 netsnmp_handler_registration * netsnmp_create_handler_registration
95 (const char *name, Netsnmp_Node_Handler *handler_access_method, oid
96 *reg_oid, size_t reg_oid_len, int modes)
97 int netsnmp_register_handler (netsnmp_handler_registration *reginfo)
98 register a handler, as defined by the netsnmp_handler_registration
99 pointer.
100 int netsnmp_unregister_handler (netsnmp_handler_registration *reginfo)
101 unregister a handler, as defined by the
102 netsnmp_handler_registration pointer.
103 int netsnmp_register_handler_nocallback (netsnmp_handler_registration
104 *reginfo)
105 register a handler, as defined by the netsnmp_handler_registration
106 pointer.
107 int netsnmp_inject_handler_before (netsnmp_handler_registration
108 *reginfo, netsnmp_mib_handler *handler, const char *before_what)
109 inject a new handler into the calling chain of the handlers
110 definedy by the netsnmp_handler_registration pointer.
111 int netsnmp_inject_handler (netsnmp_handler_registration *reginfo,
112 netsnmp_mib_handler *handler)
113 inject a new handler into the calling chain of the handlers
114 definedy by the netsnmp_handler_registration pointer.
115 NETSNMP_INLINE int netsnmp_call_handler (netsnmp_mib_handler
116 *next_handler, netsnmp_handler_registration *reginfo,
117 netsnmp_agent_request_info *reqinfo, netsnmp_request_info
118 *requests)
119 calls a handler with with appropriate NULL checking of arguments,
120 etc.
121 int netsnmp_call_handlers (netsnmp_handler_registration *reginfo,
122 netsnmp_agent_request_info *reqinfo, netsnmp_request_info
123 *requests)
124 NETSNMP_INLINE int netsnmp_call_next_handler (netsnmp_mib_handler
125 *current, netsnmp_handler_registration *reginfo,
126 netsnmp_agent_request_info *reqinfo, netsnmp_request_info
127 *requests)
128 calls the next handler in the chain after the current one with with
129 appropriate NULL checking, etc.
130 NETSNMP_INLINE int netsnmp_call_next_handler_one_request
131 (netsnmp_mib_handler *current, netsnmp_handler_registration
132 *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info
133 *requests)
134 calls the next handler in the chain after the current one with with
135 appropriate NULL checking, etc.
136 void netsnmp_handler_free (netsnmp_mib_handler *handler)
137 free's the resourceses associated with a given handler
138 netsnmp_mib_handler * netsnmp_handler_dup (netsnmp_mib_handler
139 *handler)
140 dulpicates a handler and all subsequent handlers see also
141 _clone_handler
142 void netsnmp_handler_registration_free (netsnmp_handler_registration
143 *reginfo)
144 free the resources associated with a handler registration object
145 netsnmp_handler_registration * netsnmp_handler_registration_dup
146 (netsnmp_handler_registration *reginfo)
147 duplicates the handler registration object
148 NETSNMP_INLINE netsnmp_delegated_cache * netsnmp_create_delegated_cache
149 (netsnmp_mib_handler *handler, netsnmp_handler_registration
150 *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info
151 *requests, void *localinfo)
152 creates a cache of information which can be saved for future
153 reference.
154 NETSNMP_INLINE netsnmp_delegated_cache * netsnmp_handler_check_cache
155 (netsnmp_delegated_cache *dcache)
156 check's a given cache and returns it if it is still valid (ie, the
157 agent still considers it to be an outstanding request.
158 NETSNMP_INLINE void netsnmp_free_delegated_cache
159 (netsnmp_delegated_cache *dcache)
160 frees a cache once you're finished using it
161 void netsnmp_handler_mark_requests_as_delegated (netsnmp_request_info
162 *requests, int isdelegated)
163 marks a list of requests as delegated (or not if isdelegaded = 0)
164 NETSNMP_INLINE void netsnmp_request_add_list_data (netsnmp_request_info
165 *request, netsnmp_data_list *node)
166 add data to a request that can be extracted later by submodules
167 NETSNMP_INLINE int netsnmp_request_remove_list_data
168 (netsnmp_request_info *request, const char *name)
169 remove data from a request
170 NETSNMP_INLINE void * netsnmp_request_get_list_data
171 (netsnmp_request_info *request, const char *name)
172 extract data from a request that was added previously by a parent
173 module
174 NETSNMP_INLINE void netsnmp_free_request_data_set (netsnmp_request_info
175 *request)
176 Free the extra data stored in a request.
177 NETSNMP_INLINE void netsnmp_free_request_data_sets
178 (netsnmp_request_info *request)
179 Free the extra data stored in a bunch of requests (all data in the
180 chain).
181 netsnmp_mib_handler * netsnmp_find_handler_by_name
182 (netsnmp_handler_registration *reginfo, const char *name)
183 Returns a handler from a chain based on the name.
184 void * netsnmp_find_handler_data_by_name (netsnmp_handler_registration
185 *reginfo, const char *name)
186 Returns a handler's void * pointer from a chain based on the name.
187 void handler_free_callback (void *free)
188 void netsnmp_register_handler_by_name (const char *name,
189 netsnmp_mib_handler *handler)
190 registers a given handler by name so that it can be found easily
191 later.
192 void netsnmp_clear_handler_list (void)
193 clears the entire handler-registration list
194 void netsnmp_inject_handler_into_subtree (netsnmp_subtree *tp, const
195 char *name, netsnmp_mib_handler *handler, const char *before_what)
196 void parse_injectHandler_conf (const char *token, char *cptr)
197 void netsnmp_init_handler_conf (void)
198 void * netsnmp_handler_get_parent_data (netsnmp_request_info *, const
199 char *)
200
202 The basic theory goes something like this: In the past, with the
203 original mib module api (which derived from the original CMU SNMP code)
204 the underlying mib modules were passed very little information (only
205 the truly most basic information about a request).
206
207 This worked well at the time but in todays world of subagents, device
208 instrumentation, low resource consumption, etc, it just isn't flexible
209 enough. 'handlers' are here to fix all that.
210
211 With the rewrite of the agent internals for the net-snmp 5.0 release,
212 we introduce a modular calling scheme that allows agent modules to be
213 written in a very flexible manner, and more importantly allows reuse of
214 code in a decent way (and without the memory and speed overheads of OO
215 languages like C++).
216
217 Functionally, the notion of what a handler does is the same as the
218 older api: A handler is created and then registered with the main agent
219 at a given OID in the OID tree and gets called any time a request is
220 made that it should respond to. You probably should use one of the
221 convenience helpers instead of doing anything else yourself though:
222
223 Most importantly, though, is that the handlers are built on the notion
224 of modularity and reuse. Specifically, rather than do all the really
225 hard work (like parsing table indexes out of an incoming oid request)
226 in each module, the API is designed to make it easy to write 'helper'
227 handlers that merely process some aspect of the request before passing
228 it along to the final handler that returns the real answer. Most people
229 will want to make use of the instance, table, table_iterator,
230 table_data, or table_dataset helpers to make their life easier. These
231 'helpers' interpert important aspects of the request and pass them on
232 to you.
233
234 For instance, the table helper is designed to hand you a list of
235 extracted index values from an incoming request. THe table_iterator
236 helper is built on top of the table helper, and is designed to help you
237 iterate through data stored elsewhere (like in a kernel) that is not in
238 OID lexographical order (ie, don't write your own index/oid sorting
239 routine, use this helper instead). The beauty of the table_iterator
240 helper, as well as the instance helper is that they take care of the
241 complex GETNEXT processing entirely for you and hand you everything you
242 need to merely return the data as if it was a GET request. Much less
243 code and hair pulling. I've pulled all my hair out to help you so that
244 only one of us has to be bald.
245
247 struct netsnmp_handler_registration_s netsnmp_handler_registration
248 Typedefs the netsnmp_handler_registration_s struct into
249 netsnmp_handler_registration.
250
251 struct netsnmp_mib_handler_s netsnmp_mib_handler
252 Typedefs the netsnmp_mib_handler_s struct into netsnmp_mib_handler.
253
255 int netsnmp_call_handler (netsnmp_mib_handler * next_handler,
256 netsnmp_handler_registration * reginfo, netsnmp_agent_request_info *
257 reqinfo, netsnmp_request_info * requests)
258 calls a handler with with appropriate NULL checking of arguments, etc.
259
260 Definition at line 394 of file agent_handler.c.
261
262 References netsnmp_mib_handler_s::access_method,
263 netsnmp_mib_handler_s::handler_name, MIB_HANDLER_AUTO_NEXT,
264 MIB_HANDLER_AUTO_NEXT_OVERRIDE_ONCE,
265 netsnmp_agent_request_info_s::mode, netsnmp_mib_handler_s::next, NULL,
266 and snmp_log().
267
268 Referenced by netsnmp_call_next_handler(),
269 netsnmp_call_next_handler_one_request(),
270 netsnmp_mode_end_call_helper(), and
271 netsnmp_multiplexer_helper_handler().
272
273 int netsnmp_call_next_handler (netsnmp_mib_handler * current,
274 netsnmp_handler_registration * reginfo, netsnmp_agent_request_info *
275 reqinfo, netsnmp_request_info * requests)
276 calls the next handler in the chain after the current one with with
277 appropriate NULL checking, etc.
278
279 Definition at line 524 of file agent_handler.c.
280
281 References netsnmp_call_handler(), netsnmp_mib_handler_s::next, NULL,
282 and snmp_log().
283
284 Referenced by _netsnmp_stash_cache_load(),
285 netsnmp_bulk_to_next_helper(), netsnmp_debug_helper(),
286 netsnmp_instance_counter32_handler(),
287 netsnmp_instance_helper_handler(), netsnmp_instance_int_handler(),
288 netsnmp_instance_long_handler(), netsnmp_instance_num_file_handler(),
289 netsnmp_instance_uint_handler(), netsnmp_instance_ulong_handler(),
290 netsnmp_mode_end_call_helper(), netsnmp_scalar_group_helper_handler(),
291 netsnmp_scalar_helper_handler(), netsnmp_serialize_helper_handler(),
292 netsnmp_stash_to_next_helper(), and table_helper_handler().
293
294 int netsnmp_call_next_handler_one_request (netsnmp_mib_handler * current,
295 netsnmp_handler_registration * reginfo, netsnmp_agent_request_info *
296 reqinfo, netsnmp_request_info * requests)
297 calls the next handler in the chain after the current one with with
298 appropriate NULL checking, etc.
299
300 Definition at line 546 of file agent_handler.c.
301
302 References netsnmp_call_handler(), netsnmp_mib_handler_s::next,
303 netsnmp_request_info_s::next, NULL, and snmp_log().
304
305 void netsnmp_clear_handler_list (void)
306 clears the entire handler-registration list
307
308 Definition at line 905 of file agent_handler.c.
309
310 References netsnmp_free_all_list_data(), and NULL.
311
312 Referenced by shutdown_agent().
313
314 NETSNMP_INLINE netsnmp_delegated_cache * netsnmp_create_delegated_cache
315 (netsnmp_mib_handler * handler, netsnmp_handler_registration * reginfo,
316 netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests,
317 void * localinfo)
318 creates a cache of information which can be saved for future reference.
319
320 Use netsnmp_handler_check_cache() later to make sure it's still valid
321 before referencing it in the future.
322
323 Examples:
324 delayed_instance.c.
325
326 Definition at line 696 of file agent_handler.c.
327
328 References netsnmp_agent_request_info_s::asp,
329 netsnmp_delegated_cache_s::handler,
330 netsnmp_delegated_cache_s::localinfo, netsnmp_agent_session_s::pdu,
331 netsnmp_delegated_cache_s::reginfo, netsnmp_delegated_cache_s::reqinfo,
332 netsnmp_delegated_cache_s::requests, SNMP_MALLOC_TYPEDEF,
333 netsnmp_delegated_cache_s::transaction_id, and snmp_pdu::transid.
334
335 netsnmp_mib_handler * netsnmp_create_handler (const char * name,
336 Netsnmp_Node_Handler * handler_access_method)
337 creates a netsnmp_mib_handler structure given a name and a access
338 method.
339
340 The returned handler should then be registered.
341
342 Parameters:
343 name is the handler name and is copied then assigned to
344 netsnmp_mib_handler->handler_name
345 handler_access_method is a function pointer used as the access
346 method for this handler registration instance for whatever required
347 needs.
348
349 Returns:
350 a pointer to a populated netsnmp_mib_handler struct to be
351 registered
352
353 See also:
354 netsnmp_create_handler_registration()
355
356 netsnmp_register_handler()
357
358 Definition at line 105 of file agent_handler.c.
359
360 References netsnmp_mib_handler_s::access_method,
361 netsnmp_mib_handler_s::handler_name, NULL, SNMP_FREE, and
362 SNMP_MALLOC_TYPEDEF.
363
364 Referenced by get_old_api_handler(),
365 netsnmp_baby_steps_access_multiplexer_get(),
366 netsnmp_baby_steps_handler_get(), netsnmp_cache_handler_get(),
367 netsnmp_container_table_handler_get(),
368 netsnmp_create_handler_registration(),
369 netsnmp_get_bulk_to_next_handler(), netsnmp_get_debug_handler(),
370 netsnmp_get_instance_handler(), netsnmp_get_mode_end_call_handler(),
371 netsnmp_get_multiplexer_handler(), netsnmp_get_read_only_handler(),
372 netsnmp_get_row_merge_handler(), netsnmp_get_scalar_group_handler(),
373 netsnmp_get_scalar_handler(), netsnmp_get_serialize_handler(),
374 netsnmp_get_stash_to_next_handler(), netsnmp_get_table_data_handler(),
375 netsnmp_get_table_data_set_handler(), netsnmp_get_table_handler(),
376 netsnmp_get_table_iterator_handler(), netsnmp_get_tdata_handler(),
377 netsnmp_get_timed_bare_stash_cache_handler(),
378 netsnmp_get_watched_spinlock_handler(),
379 netsnmp_get_watched_timestamp_handler(), netsnmp_get_watcher_handler(),
380 netsnmp_sparse_table_handler_get(), netsnmp_sparse_table_register(),
381 netsnmp_table_array_register(), and netsnmp_table_row_handler_get().
382
383 netsnmp_mib_handler * netsnmp_find_handler_by_name
384 (netsnmp_handler_registration * reginfo, const char * name)
385 Returns a handler from a chain based on the name.
386
387 Definition at line 838 of file agent_handler.c.
388
389 References netsnmp_handler_registration_s::handler,
390 netsnmp_mib_handler_s::handler_name, netsnmp_mib_handler_s::next, and
391 NULL.
392
393 Referenced by netsnmp_find_handler_data_by_name().
394
395 void * netsnmp_find_handler_data_by_name (netsnmp_handler_registration *
396 reginfo, const char * name)
397 Returns a handler's void * pointer from a chain based on the name.
398
399 This probably shouldn't be used by the general public as the void *
400 data may change as a handler evolves. Handlers should really advertise
401 some function for you to use instead.
402
403 Definition at line 855 of file agent_handler.c.
404
405 References netsnmp_mib_handler_s::myvoid,
406 netsnmp_find_handler_by_name(), and NULL.
407
408 Referenced by netsnmp_find_table_registration_info().
409
410 NETSNMP_INLINE void netsnmp_free_delegated_cache (netsnmp_delegated_cache *
411 dcache)
412 frees a cache once you're finished using it
413
414 Examples:
415 delayed_instance.c.
416
417 Definition at line 734 of file agent_handler.c.
418
419 References SNMP_FREE.
420
421 NETSNMP_INLINE void netsnmp_free_request_data_set (netsnmp_request_info *
422 request)
423 Free the extra data stored in a request.
424
425 Definition at line 820 of file agent_handler.c.
426
427 References netsnmp_free_list_data(), and
428 netsnmp_request_info_s::parent_data.
429
430 NETSNMP_INLINE void netsnmp_free_request_data_sets (netsnmp_request_info *
431 request)
432 Free the extra data stored in a bunch of requests (all data in the
433 chain).
434
435 Definition at line 828 of file agent_handler.c.
436
437 References netsnmp_free_all_list_data(), NULL, and
438 netsnmp_request_info_s::parent_data.
439
440 Referenced by free_agent_snmp_session(), get_set_cache(),
441 netsnmp_add_varbind_to_cache(), and netsnmp_delete_request_infos().
442
443 NETSNMP_INLINE netsnmp_delegated_cache * netsnmp_handler_check_cache
444 (netsnmp_delegated_cache * dcache)
445 check's a given cache and returns it if it is still valid (ie, the
446 agent still considers it to be an outstanding request.
447
448 Returns NULL if it's no longer valid.
449
450 Examples:
451 delayed_instance.c.
452
453 Definition at line 720 of file agent_handler.c.
454
455 References netsnmp_check_transaction_id(), NULL, and
456 netsnmp_delegated_cache_s::transaction_id.
457
458 netsnmp_mib_handler * netsnmp_handler_dup (netsnmp_mib_handler * handler)
459 dulpicates a handler and all subsequent handlers see also
460 _clone_handler
461
462 Definition at line 591 of file agent_handler.c.
463
464 References netsnmp_mib_handler_s::myvoid, netsnmp_handler_free(),
465 netsnmp_mib_handler_s::next, NULL, and netsnmp_mib_handler_s::prev.
466
467 Referenced by netsnmp_handler_registration_dup().
468
469 void netsnmp_handler_free (netsnmp_mib_handler * handler)
470 free's the resourceses associated with a given handler
471
472 make sure we aren't pointing to ourselves.
473
474 XXX : segv here at shutdown if SHUTDOWN_AGENT_CLEANLY defined. About 30
475 functions down the stack, starting in clear_context() ->
476 clear_subtree()
477
478 Definition at line 569 of file agent_handler.c.
479
480 References netsnmp_mib_handler_s::handler_name,
481 netsnmp_mib_handler_s::next, NULL, and SNMP_FREE.
482
483 Referenced by handler_free_callback(),
484 netsnmp_baby_steps_handler_get(), netsnmp_get_scalar_group_handler(),
485 netsnmp_get_timed_bare_stash_cache_handler(), netsnmp_handler_dup(),
486 and netsnmp_handler_registration_free().
487
488 void netsnmp_handler_mark_requests_as_delegated (netsnmp_request_info *
489 requests, int isdelegated)
490 marks a list of requests as delegated (or not if isdelegaded = 0)
491
492 Definition at line 748 of file agent_handler.c.
493
494 References netsnmp_request_info_s::delegated, and
495 netsnmp_request_info_s::next.
496
497 netsnmp_handler_registration * netsnmp_handler_registration_create (const
498 char * name, netsnmp_mib_handler * handler, oid * reg_oid, size_t
499 reg_oid_len, int modes)
500 creates a handler registration structure given a name, a access_method
501 function, a registration location oid and the modes the handler
502 supports.
503
504 If modes == 0, then modes will automatically be set to the default
505 value of only HANDLER_CAN_DEFAULT, which is by default read-only GET
506 and GETNEXT requests. A hander which supports sets but not row creation
507 should set us a mode of HANDLER_CAN_SET_ONLY.
508
509 Note:
510 This ends up calling netsnmp_create_handler(name,
511 handler_access_method)
512
513 Parameters:
514 name is the handler name and is copied then assigned to
515 netsnmp_handler_registration->handlerName.
516 handler is a function pointer used as the access method for this
517 handler registration instance for whatever required needs.
518 reg_oid is the registration location oid.
519 reg_oid_len is the length of reg_oid, can use the macro, OID_LENGTH
520 modes is used to configure read/write access. If modes == 0, then
521 modes will automatically be set to the default value of only
522 HANDLER_CAN_DEFAULT, which is by default read-only GET and GETNEXT
523 requests. The other two mode options are read only,
524 HANDLER_CAN_RONLY, and read/write, HANDLER_CAN_RWRITE.
525
526 · HANDLER_CAN_GETANDGETNEXT
527
528 · HANDLER_CAN_SET
529
530 · HANDLER_CAN_GETBULK
531
532 · HANDLER_CAN_RONLY (HANDLER_CAN_GETANDGETNEXT)
533
534 · HANDLER_CAN_RWRITE (HANDLER_CAN_GETANDGETNEXT | HANDLER_CAN_SET)
535
536 · HANDLER_CAN_DEFAULT HANDLER_CAN_RONLY
537
538 Returns:
539 Returns a pointer to a netsnmp_handler_registration struct. NULL is
540 returned only when memory could not be allocated for the
541 netsnmp_handler_registration struct.
542
543 See also:
544 netsnmp_create_handler()
545
546 netsnmp_register_handler()
547
548 Definition at line 163 of file agent_handler.c.
549
550 References netsnmp_handler_registration_s::handler,
551 HANDLER_CAN_DEFAULT, netsnmp_handler_registration_s::handlerName,
552 memdup(), netsnmp_handler_registration_s::modes, NULL,
553 netsnmp_handler_registration_s::priority,
554 netsnmp_handler_registration_s::rootoid,
555 netsnmp_handler_registration_s::rootoid_len, and SNMP_MALLOC_TYPEDEF.
556
557 Referenced by netsnmp_create_handler_registration().
558
559 netsnmp_handler_registration * netsnmp_handler_registration_dup
560 (netsnmp_handler_registration * reginfo)
561 duplicates the handler registration object
562
563 Definition at line 634 of file agent_handler.c.
564
565 References netsnmp_handler_registration_s::contextName,
566 netsnmp_handler_registration_s::handler,
567 netsnmp_handler_registration_s::handlerName, memdup(),
568 netsnmp_handler_registration_s::modes, netsnmp_handler_dup(),
569 netsnmp_handler_registration_free(), NULL,
570 netsnmp_handler_registration_s::priority,
571 netsnmp_handler_registration_s::range_subid,
572 netsnmp_handler_registration_s::range_ubound,
573 netsnmp_handler_registration_s::rootoid,
574 netsnmp_handler_registration_s::rootoid_len, and
575 netsnmp_handler_registration_s::timeout.
576
577 Referenced by netsnmp_subtree_deepcopy().
578
579 void netsnmp_handler_registration_free (netsnmp_handler_registration *
580 reginfo)
581 free the resources associated with a handler registration object
582
583 Definition at line 620 of file agent_handler.c.
584
585 References netsnmp_handler_registration_s::contextName,
586 netsnmp_handler_registration_s::handler,
587 netsnmp_handler_registration_s::handlerName, netsnmp_handler_free(),
588 NULL, netsnmp_handler_registration_s::rootoid,
589 netsnmp_handler_registration_s::rootoid_len, and SNMP_FREE.
590
591 Referenced by netsnmp_handler_registration_dup(),
592 netsnmp_register_mib(), netsnmp_subtree_free(), and
593 unregister_mibs_by_session().
594
595 int netsnmp_inject_handler (netsnmp_handler_registration * reginfo,
596 netsnmp_mib_handler * handler)
597 inject a new handler into the calling chain of the handlers definedy by
598 the netsnmp_handler_registration pointer.
599
600 The new handler is injected at the top of the list and hence will be
601 the new handler to be called first.
602
603 Definition at line 386 of file agent_handler.c.
604
605 References netsnmp_inject_handler_before(), and NULL.
606
607 Referenced by netsnmp_cache_handler_register(),
608 netsnmp_container_table_register(), netsnmp_register_cache_handler(),
609 netsnmp_register_handler(), netsnmp_register_instance(),
610 netsnmp_register_read_only_instance(),
611 netsnmp_register_read_only_scalar(),
612 netsnmp_register_read_only_table_data(), netsnmp_register_row_merge(),
613 netsnmp_register_scalar(), netsnmp_register_scalar_group(),
614 netsnmp_register_serialize(), netsnmp_register_table(),
615 netsnmp_register_table_data(), netsnmp_register_table_data_set(),
616 netsnmp_register_table_iterator(), netsnmp_register_watched_instance(),
617 netsnmp_register_watched_scalar(), netsnmp_register_watched_spinlock(),
618 netsnmp_sparse_table_register(), netsnmp_table_array_register(),
619 netsnmp_table_row_register(), netsnmp_tdata_register(), and
620 netsnmp_watched_timestamp_register().
621
622 int netsnmp_inject_handler_before (netsnmp_handler_registration * reginfo,
623 netsnmp_mib_handler * handler, const char * before_what)
624 inject a new handler into the calling chain of the handlers definedy by
625 the netsnmp_handler_registration pointer.
626
627 The new handler is injected after the before_what handler, or if NULL
628 at the top of the list and hence will be the new handler to be called
629 first.
630
631 Definition at line 329 of file agent_handler.c.
632
633 References netsnmp_handler_registration_s::handler,
634 netsnmp_mib_handler_s::handler_name, netsnmp_mib_handler_s::next, NULL,
635 netsnmp_mib_handler_s::prev, and snmp_log().
636
637 Referenced by netsnmp_inject_handler(), and
638 netsnmp_inject_handler_into_subtree().
639
640 int netsnmp_register_handler (netsnmp_handler_registration * reginfo)
641 register a handler, as defined by the netsnmp_handler_registration
642 pointer.
643
644 Definition at line 202 of file agent_handler.c.
645
646 References netsnmp_handler_registration_s::contextName,
647 netsnmp_mib_handler_s::flags, netsnmp_handler_registration_s::handler,
648 HANDLER_CAN_DEFAULT, HANDLER_CAN_GETBULK,
649 netsnmp_mib_handler_s::handler_name,
650 netsnmp_handler_registration_s::handlerName, MIB_HANDLER_INSTANCE,
651 netsnmp_handler_registration_s::modes,
652 netsnmp_get_bulk_to_next_handler(), netsnmp_inject_handler(),
653 netsnmp_register_mib(), netsnmp_mib_handler_s::next, NULL,
654 netsnmp_handler_registration_s::priority,
655 netsnmp_handler_registration_s::range_subid,
656 netsnmp_handler_registration_s::range_ubound,
657 netsnmp_handler_registration_s::rootoid,
658 netsnmp_handler_registration_s::rootoid_len, snmp_log(), and
659 netsnmp_handler_registration_s::timeout.
660
661 Referenced by netsnmp_cache_handler_register(),
662 netsnmp_register_cache_handler(), netsnmp_register_old_api(),
663 netsnmp_register_row_merge(), netsnmp_register_serialize(),
664 netsnmp_register_table(), netsnmp_sparse_table_register(), and
665 netsnmp_table_row_register().
666
667 void netsnmp_register_handler_by_name (const char * name,
668 netsnmp_mib_handler * handler)
669 registers a given handler by name so that it can be found easily later.
670
671 Definition at line 893 of file agent_handler.c.
672
673 References handler_free_callback(), netsnmp_add_list_data(), and
674 netsnmp_create_data_list().
675
676 Referenced by netsnmp_baby_steps_handler_init(),
677 netsnmp_init_bulk_to_next_helper(), netsnmp_init_debug_helper(),
678 netsnmp_init_read_only_helper(), netsnmp_init_row_merge(),
679 netsnmp_init_serialize(), and netsnmp_init_stash_cache_helper().
680
681 int netsnmp_register_handler_nocallback (netsnmp_handler_registration *
682 reginfo)
683 register a handler, as defined by the netsnmp_handler_registration
684 pointer.
685
686 Definition at line 277 of file agent_handler.c.
687
688 References netsnmp_handler_registration_s::contextName,
689 netsnmp_handler_registration_s::handler, HANDLER_CAN_DEFAULT,
690 netsnmp_mib_handler_s::handler_name,
691 netsnmp_handler_registration_s::modes, netsnmp_register_mib(),
692 netsnmp_mib_handler_s::next, NULL,
693 netsnmp_handler_registration_s::priority,
694 netsnmp_handler_registration_s::range_subid,
695 netsnmp_handler_registration_s::range_ubound,
696 netsnmp_handler_registration_s::rootoid,
697 netsnmp_handler_registration_s::rootoid_len, snmp_log(), and
698 netsnmp_handler_registration_s::timeout.
699
700 NETSNMP_INLINE void netsnmp_request_add_list_data (netsnmp_request_info *
701 request, netsnmp_data_list * node)
702 add data to a request that can be extracted later by submodules
703
704 Parameters:
705 request the netsnmp request info structure
706 node this is the data to be added to the linked list
707 request->parent_data
708
709 Returns:
710 void
711
712 Examples:
713 delayed_instance.c.
714
715 Definition at line 768 of file agent_handler.c.
716
717 References netsnmp_add_list_data(), and
718 netsnmp_request_info_s::parent_data.
719
720 Referenced by _netsnmp_tdata_helper_handler(),
721 netsnmp_container_table_row_insert(),
722 netsnmp_insert_iterator_context(), netsnmp_insert_table_row(),
723 netsnmp_instance_int_handler(), netsnmp_instance_long_handler(),
724 netsnmp_instance_num_file_handler(), netsnmp_instance_uint_handler(),
725 netsnmp_instance_ulong_handler(), netsnmp_table_data_helper_handler(),
726 netsnmp_table_data_set_helper_handler(),
727 netsnmp_table_iterator_helper_handler(),
728 netsnmp_watcher_helper_handler(), and table_helper_handler().
729
730 NETSNMP_INLINE void * netsnmp_request_get_list_data (netsnmp_request_info *
731 request, const char * name)
732 extract data from a request that was added previously by a parent
733 module
734
735 Parameters:
736 request the netsnmp request info function
737 name used to compare against the request->parent_data->name value,
738 if a match is found request->parent_data->data is returned
739
740 Returns:
741 a void pointer(request->parent_data->data), otherwise NULL is
742 returned if request is NULL or request->parent_data is NULL or
743 request->parent_data object is not found.
744
745 Examples:
746 delayed_instance.c.
747
748 Definition at line 810 of file agent_handler.c.
749
750 References netsnmp_get_list_data(), NULL, and
751 netsnmp_request_info_s::parent_data.
752
753 Referenced by netsnmp_container_table_container_extract(),
754 netsnmp_container_table_extract_context(),
755 netsnmp_container_table_row_extract(), netsnmp_extract_array_context(),
756 netsnmp_extract_iterator_context(), netsnmp_extract_table(),
757 netsnmp_extract_table_data_set(), netsnmp_extract_table_info(),
758 netsnmp_extract_table_row(), netsnmp_instance_int_handler(),
759 netsnmp_instance_long_handler(), netsnmp_instance_num_file_handler(),
760 netsnmp_instance_uint_handler(), netsnmp_instance_ulong_handler(),
761 netsnmp_table_row_extract(), netsnmp_tdata_extract_container(),
762 netsnmp_tdata_extract_table(), and netsnmp_watcher_helper_handler().
763
764 NETSNMP_INLINE int netsnmp_request_remove_list_data (netsnmp_request_info *
765 request, const char * name)
766 remove data from a request
767
768 Parameters:
769 request the netsnmp request info structure
770 name this is the name of the previously added data
771
772 Returns:
773 0 on successful find-and-delete, 1 otherwise.
774
775 Definition at line 789 of file agent_handler.c.
776
777 References netsnmp_remove_list_node(), NULL, and
778 netsnmp_request_info_s::parent_data.
779
780 int netsnmp_unregister_handler (netsnmp_handler_registration * reginfo)
781 unregister a handler, as defined by the netsnmp_handler_registration
782 pointer.
783
784 Definition at line 267 of file agent_handler.c.
785
786 References netsnmp_handler_registration_s::contextName,
787 netsnmp_handler_registration_s::priority,
788 netsnmp_handler_registration_s::range_subid,
789 netsnmp_handler_registration_s::range_ubound,
790 netsnmp_handler_registration_s::rootoid,
791 netsnmp_handler_registration_s::rootoid_len, and
792 unregister_mib_context().
793
794
795
796Version 5.4 Net2-4SNNMoPvA2g0e0n6t handler and extensibility API(3)