File: netsnmp_handler.3

package info (click to toggle)
net-snmp 5.2.3-7etch4
  • links: PTS
  • area: main
  • in suites: etch
  • size: 24,452 kB
  • ctags: 16,045
  • sloc: ansic: 175,930; perl: 11,814; sh: 11,230; makefile: 5,375; pascal: 62
file content (686 lines) | stat: -rw-r--r-- 34,392 bytes parent folder | download | duplicates (2)
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
.TH "Net-SNMP Agent handler and extensibility API" 3 "14 Jul 2006" "Version 5.2.3" "net-snmp" \" -*- nroff -*-
.ad l
.nh
.SH NAME
Net-SNMP Agent handler and extensibility API \- The basic theory goes something like this: In the past, with the original mib module api (which derived from the original CMU SNMP code) the underlying mib modules were passed very little information (only the truly most basic information about a request).  

.PP
.SS "Modules"

.in +1c
.ti -1c
.RI "\fButility_handlers\fP"
.br
.RI "\fISimplify request processing A group of handlers intended to simplify certain aspects of processing a request for a MIB object. \fP"
.PP
.in +1c

.ti -1c
.RI "\fBleaf_handlers\fP"
.br
.RI "\fIProcess individual leaf objects A group of handlers to implement individual leaf objects and instances (both scalar objects, and individual objects and instances within a table). \fP"
.PP
.in +1c

.ti -1c
.RI "\fBbaby_steps\fP"
.br
.RI "\fICalls your handler in baby_steps for set processing. \fP"
.PP
.in +1c

.ti -1c
.RI "\fBold_api\fP"
.br
.RI "\fICalls mib module code written in the old style of code. \fP"
.PP
.in +1c

.ti -1c
.RI "\fBstash_cache\fP"
.br
.RI "\fIAutomatically caches data for certain handlers. \fP"
.PP
.in +1c

.ti -1c
.RI "\fBtable\fP"
.br
.RI "\fIHelps you implement a table. \fP"
.PP

.in -1c
.SS "Data Structures"

.in +1c
.ti -1c
.RI "struct \fBnetsnmp_mib_handler_s\fP"
.br
.RI "\fIthe mib handler structure to be registered \fP"
.ti -1c
.RI "struct \fBnetsnmp_handler_registration_s\fP"
.br
.RI "\fIRoot registration info. \fP"
.ti -1c
.RI "struct \fBnetsnmp_handler_args_s\fP"
.br
.ti -1c
.RI "struct \fBnetsnmp_delegated_cache_s\fP"
.br
.ti -1c
.RI "struct \fBnetsnmp_mib_handler_s\fP"
.br
.RI "\fIthe mib handler structure to be registered \fP"
.ti -1c
.RI "struct \fBnetsnmp_handler_registration_s\fP"
.br
.RI "\fIRoot registration info. \fP"
.in -1c
.SS "Defines"

.in +1c
.ti -1c
.RI "#define \fBMIB_HANDLER_AUTO_NEXT\fP   0x00000001"
.br
.ti -1c
.RI "#define \fBMIB_HANDLER_AUTO_NEXT_OVERRIDE_ONCE\fP   0x00000002"
.br
.ti -1c
.RI "#define \fBMIB_HANDLER_CUSTOM4\fP   0x10000000"
.br
.ti -1c
.RI "#define \fBMIB_HANDLER_CUSTOM3\fP   0x20000000"
.br
.ti -1c
.RI "#define \fBMIB_HANDLER_CUSTOM2\fP   0x40000000"
.br
.ti -1c
.RI "#define \fBMIB_HANDLER_CUSTOM1\fP   0x80000000"
.br
.ti -1c
.RI "#define \fBHANDLER_CAN_GETANDGETNEXT\fP   0x01"
.br
.ti -1c
.RI "#define \fBHANDLER_CAN_SET\fP   0x02"
.br
.ti -1c
.RI "#define \fBHANDLER_CAN_GETBULK\fP   0x04"
.br
.ti -1c
.RI "#define \fBHANDLER_CAN_NOT_CREATE\fP   0x08"
.br
.ti -1c
.RI "#define \fBHANDLER_CAN_BABY_STEP\fP   0x10"
.br
.ti -1c
.RI "#define \fBHANDLER_CAN_RONLY\fP   (HANDLER_CAN_GETANDGETNEXT)"
.br
.ti -1c
.RI "#define \fBHANDLER_CAN_RWRITE\fP   (HANDLER_CAN_GETANDGETNEXT | HANDLER_CAN_SET)"
.br
.ti -1c
.RI "#define \fBHANDLER_CAN_SET_ONLY\fP   (HANDLER_CAN_SET | HANDLER_CAN_NOT_CREATE)"
.br
.ti -1c
.RI "#define \fBHANDLER_CAN_DEFAULT\fP   (HANDLER_CAN_RONLY | HANDLER_CAN_NOT_CREATE)"
.br
.ti -1c
.RI "#define \fBREQUEST_IS_DELEGATED\fP   1"
.br
.ti -1c
.RI "#define \fBREQUEST_IS_NOT_DELEGATED\fP   0"
.br
.in -1c
.SS "Typedefs"

.in +1c
.ti -1c
.RI "typedef \fBnetsnmp_mib_handler_s\fP \fBnetsnmp_mib_handler\fP"
.br
.RI "\fITypedefs the \fBnetsnmp_mib_handler_s\fP struct into netsnmp_mib_handler. \fP"
.ti -1c
.RI "typedef \fBnetsnmp_handler_registration_s\fP \fBnetsnmp_handler_registration\fP"
.br
.RI "\fITypedefs the \fBnetsnmp_handler_registration_s\fP struct into netsnmp_handler_registration. \fP"
.ti -1c
.RI "typedef int() \fBNetsnmp_Node_Handler\fP (\fBnetsnmp_mib_handler\fP *handler, \fBnetsnmp_handler_registration\fP *reginfo, \fBnetsnmp_agent_request_info\fP *reqinfo, \fBnetsnmp_request_info\fP *requests)"
.br
.ti -1c
.RI "typedef \fBnetsnmp_handler_args_s\fP \fBnetsnmp_handler_args\fP"
.br
.ti -1c
.RI "typedef \fBnetsnmp_delegated_cache_s\fP \fBnetsnmp_delegated_cache\fP"
.br
.in -1c
.SS "Functions"

.in +1c
.ti -1c
.RI "\fBnetsnmp_mib_handler\fP * \fBnetsnmp_create_handler\fP (const char *name, \fBNetsnmp_Node_Handler\fP *handler_access_method)"
.br
.RI "\fIcreates a netsnmp_mib_handler structure given a name and a access method. \fP"
.ti -1c
.RI "\fBnetsnmp_handler_registration\fP * \fBnetsnmp_handler_registration_create\fP (const char *name, \fBnetsnmp_mib_handler\fP *handler, oid *reg_oid, size_t reg_oid_len, int modes)"
.br
.RI "\fIcreates a handler registration structure given a name, a access_method function, a registration location oid and the modes the handler supports. \fP"
.ti -1c
.RI "\fBnetsnmp_handler_registration\fP * \fBnetsnmp_create_handler_registration\fP (const char *name, \fBNetsnmp_Node_Handler\fP *handler_access_method, oid *reg_oid, size_t reg_oid_len, int modes)"
.br
.ti -1c
.RI "int \fBnetsnmp_register_handler\fP (\fBnetsnmp_handler_registration\fP *reginfo)"
.br
.RI "\fIregister a handler, as defined by the netsnmp_handler_registration pointer. \fP"
.ti -1c
.RI "int \fBnetsnmp_unregister_handler\fP (\fBnetsnmp_handler_registration\fP *reginfo)"
.br
.RI "\fIunregister a handler, as defined by the netsnmp_handler_registration pointer. \fP"
.ti -1c
.RI "int \fBnetsnmp_register_handler_nocallback\fP (\fBnetsnmp_handler_registration\fP *reginfo)"
.br
.RI "\fIregister a handler, as defined by the netsnmp_handler_registration pointer. \fP"
.ti -1c
.RI "int \fBnetsnmp_inject_handler_before\fP (\fBnetsnmp_handler_registration\fP *reginfo, \fBnetsnmp_mib_handler\fP *handler, const char *before_what)"
.br
.RI "\fIinject a new handler into the calling chain of the handlers definedy by the netsnmp_handler_registration pointer. \fP"
.ti -1c
.RI "int \fBnetsnmp_inject_handler\fP (\fBnetsnmp_handler_registration\fP *reginfo, \fBnetsnmp_mib_handler\fP *handler)"
.br
.RI "\fIinject a new handler into the calling chain of the handlers definedy by the netsnmp_handler_registration pointer. \fP"
.ti -1c
.RI "NETSNMP_INLINE int \fBnetsnmp_call_handler\fP (\fBnetsnmp_mib_handler\fP *next_handler, \fBnetsnmp_handler_registration\fP *reginfo, \fBnetsnmp_agent_request_info\fP *reqinfo, \fBnetsnmp_request_info\fP *requests)"
.br
.RI "\fIcalls a handler with with appropriate NULL checking of arguments, etc. \fP"
.ti -1c
.RI "int \fBnetsnmp_call_handlers\fP (\fBnetsnmp_handler_registration\fP *reginfo, \fBnetsnmp_agent_request_info\fP *reqinfo, \fBnetsnmp_request_info\fP *requests)"
.br
.ti -1c
.RI "NETSNMP_INLINE int \fBnetsnmp_call_next_handler\fP (\fBnetsnmp_mib_handler\fP *current, \fBnetsnmp_handler_registration\fP *reginfo, \fBnetsnmp_agent_request_info\fP *reqinfo, \fBnetsnmp_request_info\fP *requests)"
.br
.RI "\fIcalls the next handler in the chain after the current one with with appropriate NULL checking, etc. \fP"
.ti -1c
.RI "NETSNMP_INLINE int \fBnetsnmp_call_next_handler_one_request\fP (\fBnetsnmp_mib_handler\fP *current, \fBnetsnmp_handler_registration\fP *reginfo, \fBnetsnmp_agent_request_info\fP *reqinfo, \fBnetsnmp_request_info\fP *requests)"
.br
.RI "\fIcalls the next handler in the chain after the current one with with appropriate NULL checking, etc. \fP"
.ti -1c
.RI "void \fBnetsnmp_handler_free\fP (\fBnetsnmp_mib_handler\fP *handler)"
.br
.RI "\fIfree's the resourceses associated with a given handler \fP"
.ti -1c
.RI "\fBnetsnmp_mib_handler\fP * \fBnetsnmp_handler_dup\fP (\fBnetsnmp_mib_handler\fP *handler)"
.br
.RI "\fIdulpicates a handler and all subsequent handlers see also _clone_handler \fP"
.ti -1c
.RI "void \fBnetsnmp_handler_registration_free\fP (\fBnetsnmp_handler_registration\fP *reginfo)"
.br
.RI "\fIfree the resources associated with a handler registration object \fP"
.ti -1c
.RI "\fBnetsnmp_handler_registration\fP * \fBnetsnmp_handler_registration_dup\fP (\fBnetsnmp_handler_registration\fP *reginfo)"
.br
.RI "\fIduplicates the handler registration object \fP"
.ti -1c
.RI "NETSNMP_INLINE \fBnetsnmp_delegated_cache\fP * \fBnetsnmp_create_delegated_cache\fP (\fBnetsnmp_mib_handler\fP *handler, \fBnetsnmp_handler_registration\fP *reginfo, \fBnetsnmp_agent_request_info\fP *reqinfo, \fBnetsnmp_request_info\fP *requests, void *localinfo)"
.br
.RI "\fIcreates a cache of information which can be saved for future reference. \fP"
.ti -1c
.RI "NETSNMP_INLINE \fBnetsnmp_delegated_cache\fP * \fBnetsnmp_handler_check_cache\fP (\fBnetsnmp_delegated_cache\fP *dcache)"
.br
.RI "\fIcheck's a given cache and returns it if it is still valid (ie, the agent still considers it to be an outstanding request. \fP"
.ti -1c
.RI "NETSNMP_INLINE void \fBnetsnmp_free_delegated_cache\fP (\fBnetsnmp_delegated_cache\fP *dcache)"
.br
.RI "\fIfrees a cache once you're finished using it \fP"
.ti -1c
.RI "void \fBnetsnmp_handler_mark_requests_as_delegated\fP (\fBnetsnmp_request_info\fP *requests, int isdelegated)"
.br
.RI "\fImarks a list of requests as delegated (or not if isdelegaded = 0) \fP"
.ti -1c
.RI "NETSNMP_INLINE void \fBnetsnmp_request_add_list_data\fP (\fBnetsnmp_request_info\fP *request, \fBnetsnmp_data_list\fP *\fBnode\fP)"
.br
.RI "\fIadd data to a request that can be extracted later by submodules \fP"
.ti -1c
.RI "NETSNMP_INLINE int \fBnetsnmp_request_remove_list_data\fP (\fBnetsnmp_request_info\fP *request, const char *name)"
.br
.RI "\fIremove data from a request \fP"
.ti -1c
.RI "NETSNMP_INLINE void * \fBnetsnmp_request_get_list_data\fP (\fBnetsnmp_request_info\fP *request, const char *name)"
.br
.RI "\fIextract data from a request that was added previously by a parent module \fP"
.ti -1c
.RI "NETSNMP_INLINE void \fBnetsnmp_free_request_data_set\fP (\fBnetsnmp_request_info\fP *request)"
.br
.RI "\fIFree the extra data stored in a request. \fP"
.ti -1c
.RI "NETSNMP_INLINE void \fBnetsnmp_free_request_data_sets\fP (\fBnetsnmp_request_info\fP *request)"
.br
.RI "\fIFree the extra data stored in a bunch of requests (all data in the chain). \fP"
.ti -1c
.RI "\fBnetsnmp_mib_handler\fP * \fBnetsnmp_find_handler_by_name\fP (\fBnetsnmp_handler_registration\fP *reginfo, const char *name)"
.br
.RI "\fIReturns a handler from a chain based on the name. \fP"
.ti -1c
.RI "void * \fBnetsnmp_find_handler_data_by_name\fP (\fBnetsnmp_handler_registration\fP *reginfo, const char *name)"
.br
.RI "\fIReturns a handler's void * pointer from a chain based on the name. \fP"
.ti -1c
.RI "void \fBhandler_free_callback\fP (void *free)"
.br
.ti -1c
.RI "void \fBnetsnmp_register_handler_by_name\fP (const char *name, \fBnetsnmp_mib_handler\fP *handler)"
.br
.RI "\fIregisters a given handler by name so that it can be found easily later. \fP"
.ti -1c
.RI "void \fBnetsnmp_clear_handler_list\fP (void)"
.br
.RI "\fIclears the entire handler-registration list \fP"
.ti -1c
.RI "void \fBnetsnmp_inject_handler_into_subtree\fP (\fBnetsnmp_subtree\fP *tp, const char *name, \fBnetsnmp_mib_handler\fP *handler, const char *before_what)"
.br
.ti -1c
.RI "void \fBparse_injectHandler_conf\fP (const char *token, char *cptr)"
.br
.ti -1c
.RI "void \fBnetsnmp_init_handler_conf\fP (void)"
.br
.ti -1c
.RI "void * \fBnetsnmp_handler_get_parent_data\fP (\fBnetsnmp_request_info\fP *, const char *)"
.br
.in -1c
.SH "Detailed Description"
.PP 
The basic theory goes something like this: In the past, with the original mib module api (which derived from the original CMU SNMP code) the underlying mib modules were passed very little information (only the truly most basic information about a request). 
.PP
This worked well at the time but in todays world of subagents, device instrumentation, low resource consumption, etc, it just isn't flexible enough. 'handlers' are here to fix all that.
.PP
With the rewrite of the agent internals for the net-snmp 5.0 release, we introduce a modular calling scheme that allows agent modules to be written in a very flexible manner, and more importantly allows reuse of code in a decent way (and without the memory and speed overheads of OO languages like C++).
.PP
Functionally, the notion of what a handler does is the same as the older api: A handler is \fBcreated\fP and then \fBregistered\fP with the main agent at a given OID in the OID tree and gets called any time a request is made that it should respond to. You probably should use one of the convenience helpers instead of doing anything else yourself though:
.PP
Most importantly, though, is that the handlers are built on the notion of modularity and reuse. Specifically, rather than do all the really hard work (like parsing table indexes out of an incoming oid request) in each module, the API is designed to make it easy to write 'helper' handlers that merely process some aspect of the request before passing it along to the final handler that returns the real answer. Most people will want to make use of the \fBinstance\fP, \fBtable\fP, \fBtable_iterator\fP, \fBtable_data\fP, or \fBtable_dataset\fP helpers to make their life easier. These 'helpers' interpert important aspects of the request and pass them on to you.
.PP
For instance, the \fBtable\fP helper is designed to hand you a list of extracted index values from an incoming request. THe \fBtable_iterator\fP helper is built on top of the table helper, and is designed to help you iterate through data stored elsewhere (like in a kernel) that is not in OID lexographical order (ie, don't write your own index/oid sorting routine, use this helper instead). The beauty of the \fBtable_iterator helper\fP, as well as the \fBinstance\fP helper is that they take care of the complex GETNEXT processing entirely for you and hand you everything you need to merely return the data as if it was a GET request. Much less code and hair pulling. I've pulled all my hair out to help you so that only one of us has to be bald. 
.SH "Typedef Documentation"
.PP 
.SS "struct \fBnetsnmp_handler_registration_s\fP \fBnetsnmp_handler_registration\fP"
.PP
Typedefs the \fBnetsnmp_handler_registration_s\fP struct into netsnmp_handler_registration. 
.PP
.SS "struct \fBnetsnmp_mib_handler_s\fP \fBnetsnmp_mib_handler\fP"
.PP
Typedefs the \fBnetsnmp_mib_handler_s\fP struct into netsnmp_mib_handler. 
.PP
.SH "Function Documentation"
.PP 
.SS "int netsnmp_call_handler (\fBnetsnmp_mib_handler\fP * next_handler, \fBnetsnmp_handler_registration\fP * reginfo, \fBnetsnmp_agent_request_info\fP * reqinfo, \fBnetsnmp_request_info\fP * requests)"
.PP
calls a handler with with appropriate NULL checking of arguments, etc. 
.PP
Definition at line 382 of file agent_handler.c.
.PP
References netsnmp_mib_handler_s::access_method, netsnmp_mib_handler_s::handler_name, MIB_HANDLER_AUTO_NEXT, MIB_HANDLER_AUTO_NEXT_OVERRIDE_ONCE, netsnmp_agent_request_info_s::mode, netsnmp_mib_handler_s::next, NULL, and snmp_log().
.PP
Referenced by netsnmp_call_next_handler(), netsnmp_call_next_handler_one_request(), netsnmp_mode_end_call_helper(), and netsnmp_multiplexer_helper_handler().
.SS "int netsnmp_call_next_handler (\fBnetsnmp_mib_handler\fP * current, \fBnetsnmp_handler_registration\fP * reginfo, \fBnetsnmp_agent_request_info\fP * reqinfo, \fBnetsnmp_request_info\fP * requests)"
.PP
calls the next handler in the chain after the current one with with appropriate NULL checking, etc. 
.PP
Definition at line 512 of file agent_handler.c.
.PP
References netsnmp_call_handler(), netsnmp_mib_handler_s::next, NULL, and snmp_log().
.PP
Referenced by netsnmp_bulk_to_next_helper(), netsnmp_debug_helper(), netsnmp_instance_counter32_handler(), netsnmp_instance_helper_handler(), netsnmp_instance_int_handler(), netsnmp_instance_long_handler(), netsnmp_instance_ulong_handler(), netsnmp_mode_end_call_helper(), netsnmp_row_merge_helper_handler(), netsnmp_scalar_group_helper_handler(), netsnmp_scalar_helper_handler(), netsnmp_serialize_helper_handler(), netsnmp_stash_cache_update(), and table_helper_handler().
.SS "int netsnmp_call_next_handler_one_request (\fBnetsnmp_mib_handler\fP * current, \fBnetsnmp_handler_registration\fP * reginfo, \fBnetsnmp_agent_request_info\fP * reqinfo, \fBnetsnmp_request_info\fP * requests)"
.PP
calls the next handler in the chain after the current one with with appropriate NULL checking, etc. 
.PP
Definition at line 534 of file agent_handler.c.
.PP
References netsnmp_call_handler(), netsnmp_mib_handler_s::next, netsnmp_request_info_s::next, NULL, and snmp_log().
.SS "void netsnmp_clear_handler_list (void)"
.PP
clears the entire handler-registration list 
.PP
Definition at line 892 of file agent_handler.c.
.PP
References netsnmp_free_all_list_data(), and NULL.
.PP
Referenced by shutdown_agent().
.SS "NETSNMP_INLINE \fBnetsnmp_delegated_cache\fP * netsnmp_create_delegated_cache (\fBnetsnmp_mib_handler\fP * handler, \fBnetsnmp_handler_registration\fP * reginfo, \fBnetsnmp_agent_request_info\fP * reqinfo, \fBnetsnmp_request_info\fP * requests, void * localinfo)"
.PP
creates a cache of information which can be saved for future reference. 
.PP
Use \fBnetsnmp_handler_check_cache()\fP later to make sure it's still valid before referencing it in the future. 
.PP
\fBExamples: \fP
.in +1c
\fBdelayed_instance.c\fP.
.PP
Definition at line 683 of file agent_handler.c.
.PP
References netsnmp_agent_request_info_s::asp, netsnmp_delegated_cache_s::handler, netsnmp_delegated_cache_s::localinfo, netsnmp_agent_session_s::pdu, netsnmp_delegated_cache_s::reginfo, netsnmp_delegated_cache_s::reqinfo, netsnmp_delegated_cache_s::requests, SNMP_MALLOC_TYPEDEF, netsnmp_delegated_cache_s::transaction_id, and snmp_pdu::transid.
.SS "\fBnetsnmp_mib_handler\fP * netsnmp_create_handler (const char * name, \fBNetsnmp_Node_Handler\fP * handler_access_method)"
.PP
creates a netsnmp_mib_handler structure given a name and a access method. 
.PP
The returned handler should then be \fBregistered.\fP
.PP
\fBParameters:\fP
.RS 4
\fIname\fP is the handler name and is copied then assigned to netsnmp_mib_handler->handler_name
.br
\fIhandler_access_method\fP is a function pointer used as the access method for this handler registration instance for whatever required needs.
.RE
.PP
\fBReturns:\fP
.RS 4
a pointer to a populated netsnmp_mib_handler struct to be registered
.RE
.PP
\fBSee also:\fP
.RS 4
\fBnetsnmp_create_handler_registration()\fP 
.PP
\fBnetsnmp_register_handler()\fP 
.RE
.PP

.PP
Definition at line 105 of file agent_handler.c.
.PP
References netsnmp_mib_handler_s::access_method, netsnmp_mib_handler_s::handler_name, NULL, SNMP_FREE, and SNMP_MALLOC_TYPEDEF.
.PP
Referenced by get_old_api_handler(), netsnmp_baby_steps_access_multiplexer_get(), netsnmp_baby_steps_handler_get(), netsnmp_cache_handler_get(), netsnmp_container_table_handler_get(), netsnmp_create_handler_registration(), netsnmp_get_bulk_to_next_handler(), netsnmp_get_debug_handler(), netsnmp_get_instance_handler(), netsnmp_get_mode_end_call_handler(), netsnmp_get_multiplexer_handler(), netsnmp_get_read_only_handler(), netsnmp_get_row_merge_handler(), netsnmp_get_scalar_group_handler(), netsnmp_get_scalar_handler(), netsnmp_get_serialize_handler(), netsnmp_get_stash_cache_handler(), netsnmp_get_table_data_handler(), netsnmp_get_table_data_set_handler(), netsnmp_get_table_handler(), netsnmp_get_table_iterator_handler(), netsnmp_get_watched_spinlock_handler(), netsnmp_get_watched_timestamp_handler(), netsnmp_get_watcher_handler(), netsnmp_sparse_table_handler_get(), and netsnmp_sparse_table_register().
.SS "\fBnetsnmp_mib_handler\fP * netsnmp_find_handler_by_name (\fBnetsnmp_handler_registration\fP * reginfo, const char * name)"
.PP
Returns a handler from a chain based on the name. 
.PP
Definition at line 825 of file agent_handler.c.
.PP
References netsnmp_handler_registration_s::handler, netsnmp_mib_handler_s::handler_name, netsnmp_mib_handler_s::next, and NULL.
.PP
Referenced by netsnmp_find_handler_data_by_name().
.SS "void * netsnmp_find_handler_data_by_name (\fBnetsnmp_handler_registration\fP * reginfo, const char * name)"
.PP
Returns a handler's void * pointer from a chain based on the name. 
.PP
This probably shouldn't be used by the general public as the void * data may change as a handler evolves. Handlers should really advertise some function for you to use instead. 
.PP
Definition at line 842 of file agent_handler.c.
.PP
References netsnmp_mib_handler_s::myvoid, netsnmp_find_handler_by_name(), and NULL.
.PP
Referenced by netsnmp_find_table_registration_info().
.SS "NETSNMP_INLINE void netsnmp_free_delegated_cache (\fBnetsnmp_delegated_cache\fP * dcache)"
.PP
frees a cache once you're finished using it 
.PP
\fBExamples: \fP
.in +1c
\fBdelayed_instance.c\fP.
.PP
Definition at line 721 of file agent_handler.c.
.PP
References SNMP_FREE.
.SS "NETSNMP_INLINE void netsnmp_free_request_data_set (\fBnetsnmp_request_info\fP * request)"
.PP
Free the extra data stored in a request. 
.PP
Definition at line 807 of file agent_handler.c.
.PP
References netsnmp_free_list_data(), and netsnmp_request_info_s::parent_data.
.SS "NETSNMP_INLINE void netsnmp_free_request_data_sets (\fBnetsnmp_request_info\fP * request)"
.PP
Free the extra data stored in a bunch of requests (all data in the chain). 
.PP
Definition at line 815 of file agent_handler.c.
.PP
References netsnmp_free_all_list_data(), NULL, and netsnmp_request_info_s::parent_data.
.PP
Referenced by free_agent_snmp_session(), get_set_cache(), netsnmp_add_varbind_to_cache(), and netsnmp_delete_request_infos().
.SS "NETSNMP_INLINE \fBnetsnmp_delegated_cache\fP * netsnmp_handler_check_cache (\fBnetsnmp_delegated_cache\fP * dcache)"
.PP
check's a given cache and returns it if it is still valid (ie, the agent still considers it to be an outstanding request. 
.PP
Returns NULL if it's no longer valid. 
.PP
\fBExamples: \fP
.in +1c
\fBdelayed_instance.c\fP.
.PP
Definition at line 707 of file agent_handler.c.
.PP
References netsnmp_check_transaction_id(), NULL, and netsnmp_delegated_cache_s::transaction_id.
.SS "\fBnetsnmp_mib_handler\fP * netsnmp_handler_dup (\fBnetsnmp_mib_handler\fP * handler)"
.PP
dulpicates a handler and all subsequent handlers see also _clone_handler 
.PP
Definition at line 579 of file agent_handler.c.
.PP
References netsnmp_mib_handler_s::myvoid, netsnmp_handler_free(), netsnmp_mib_handler_s::next, NULL, and netsnmp_mib_handler_s::prev.
.PP
Referenced by netsnmp_handler_registration_dup().
.SS "void netsnmp_handler_free (\fBnetsnmp_mib_handler\fP * handler)"
.PP
free's the resourceses associated with a given handler 
.PP
make sure we aren't pointing to ourselves.
.PP
XXX : segv here at shutdown if SHUTDOWN_AGENT_CLEANLY defined. About 30 functions down the stack, starting in \fBclear_context()\fP -> \fBclear_subtree()\fP 
.PP
Definition at line 557 of file agent_handler.c.
.PP
References netsnmp_mib_handler_s::handler_name, netsnmp_mib_handler_s::next, NULL, and SNMP_FREE.
.PP
Referenced by handler_free_callback(), netsnmp_baby_steps_handler_get(), netsnmp_get_scalar_group_handler(), netsnmp_handler_dup(), and netsnmp_handler_registration_free().
.SS "void netsnmp_handler_mark_requests_as_delegated (\fBnetsnmp_request_info\fP * requests, int isdelegated)"
.PP
marks a list of requests as delegated (or not if isdelegaded = 0) 
.PP
Definition at line 735 of file agent_handler.c.
.PP
References netsnmp_request_info_s::delegated, and netsnmp_request_info_s::next.
.SS "\fBnetsnmp_handler_registration\fP * netsnmp_handler_registration_create (const char * name, \fBnetsnmp_mib_handler\fP * handler, oid * reg_oid, size_t reg_oid_len, int modes)"
.PP
creates a handler registration structure given a name, a access_method function, a registration location oid and the modes the handler supports. 
.PP
If modes == 0, then modes will automatically be set to the default value of only HANDLER_CAN_DEFAULT, which is by default read-only GET and GETNEXT requests. A hander which supports sets but not row creation should set us a mode of HANDLER_CAN_SET_ONLY. 
.PP
\fBNote:\fP
.RS 4
This ends up calling netsnmp_create_handler(name, handler_access_method) 
.RE
.PP
\fBParameters:\fP
.RS 4
\fIname\fP is the handler name and is copied then assigned to netsnmp_handler_registration->handlerName.
.br
\fIhandler\fP is a function pointer used as the access method for this handler registration instance for whatever required needs.
.br
\fIreg_oid\fP is the registration location oid.
.br
\fIreg_oid_len\fP is the length of reg_oid, can use the macro, OID_LENGTH
.br
\fImodes\fP is used to configure read/write access. If modes == 0, then modes will automatically be set to the default value of only HANDLER_CAN_DEFAULT, which is by default read-only GET and GETNEXT requests. The other two mode options are read only, HANDLER_CAN_RONLY, and read/write, HANDLER_CAN_RWRITE.
.RE
.PP
.IP "\(bu" 2
HANDLER_CAN_GETANDGETNEXT
.IP "\(bu" 2
HANDLER_CAN_SET
.IP "\(bu" 2
HANDLER_CAN_GETBULK
.PP
.PP
.IP "\(bu" 2
HANDLER_CAN_RONLY (HANDLER_CAN_GETANDGETNEXT)
.IP "\(bu" 2
HANDLER_CAN_RWRITE (HANDLER_CAN_GETANDGETNEXT | HANDLER_CAN_SET)
.IP "\(bu" 2
HANDLER_CAN_DEFAULT HANDLER_CAN_RONLY
.PP
.PP
\fBReturns:\fP
.RS 4
Returns a pointer to a netsnmp_handler_registration struct. NULL is returned only when memory could not be allocated for the netsnmp_handler_registration struct.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBnetsnmp_create_handler()\fP 
.PP
\fBnetsnmp_register_handler()\fP 
.RE
.PP

.PP
Definition at line 163 of file agent_handler.c.
.PP
References netsnmp_handler_registration_s::handler, HANDLER_CAN_DEFAULT, netsnmp_handler_registration_s::handlerName, memdup(), netsnmp_handler_registration_s::modes, NULL, netsnmp_handler_registration_s::priority, netsnmp_handler_registration_s::rootoid, netsnmp_handler_registration_s::rootoid_len, and SNMP_MALLOC_TYPEDEF.
.PP
Referenced by netsnmp_create_handler_registration().
.SS "\fBnetsnmp_handler_registration\fP * netsnmp_handler_registration_dup (\fBnetsnmp_handler_registration\fP * reginfo)"
.PP
duplicates the handler registration object 
.PP
Definition at line 621 of file agent_handler.c.
.PP
References netsnmp_handler_registration_s::contextName, netsnmp_handler_registration_s::handler, netsnmp_handler_registration_s::handlerName, memdup(), netsnmp_handler_registration_s::modes, netsnmp_handler_dup(), netsnmp_handler_registration_free(), NULL, netsnmp_handler_registration_s::priority, netsnmp_handler_registration_s::range_subid, netsnmp_handler_registration_s::range_ubound, netsnmp_handler_registration_s::rootoid, netsnmp_handler_registration_s::rootoid_len, and netsnmp_handler_registration_s::timeout.
.PP
Referenced by netsnmp_subtree_deepcopy().
.SS "void netsnmp_handler_registration_free (\fBnetsnmp_handler_registration\fP * reginfo)"
.PP
free the resources associated with a handler registration object 
.PP
Definition at line 608 of file agent_handler.c.
.PP
References netsnmp_handler_registration_s::contextName, netsnmp_handler_registration_s::handler, netsnmp_handler_registration_s::handlerName, netsnmp_handler_free(), NULL, netsnmp_handler_registration_s::rootoid, and SNMP_FREE.
.PP
Referenced by netsnmp_handler_registration_dup(), netsnmp_register_mib(), netsnmp_subtree_free(), and unregister_mibs_by_session().
.SS "int netsnmp_inject_handler (\fBnetsnmp_handler_registration\fP * reginfo, \fBnetsnmp_mib_handler\fP * handler)"
.PP
inject a new handler into the calling chain of the handlers definedy by the netsnmp_handler_registration pointer. 
.PP
The new handler is injected at the top of the list and hence will be the new handler to be called first. 
.PP
Definition at line 374 of file agent_handler.c.
.PP
References netsnmp_inject_handler_before(), and NULL.
.PP
Referenced by netsnmp_cache_handler_register(), netsnmp_container_table_register(), netsnmp_register_cache_handler(), netsnmp_register_handler(), netsnmp_register_instance(), netsnmp_register_read_only_instance(), netsnmp_register_read_only_scalar(), netsnmp_register_read_only_table_data(), netsnmp_register_row_merge(), netsnmp_register_scalar(), netsnmp_register_scalar_group(), netsnmp_register_serialize(), netsnmp_register_table(), netsnmp_register_table_data(), netsnmp_register_table_data_set(), netsnmp_register_table_iterator(), netsnmp_register_watched_instance(), netsnmp_register_watched_scalar(), netsnmp_register_watched_spinlock(), netsnmp_register_watched_timestamp(), and netsnmp_sparse_table_register().
.SS "int netsnmp_inject_handler_before (\fBnetsnmp_handler_registration\fP * reginfo, \fBnetsnmp_mib_handler\fP * handler, const char * before_what)"
.PP
inject a new handler into the calling chain of the handlers definedy by the netsnmp_handler_registration pointer. 
.PP
The new handler is injected after the before_what handler, or if NULL at the top of the list and hence will be the new handler to be called first. 
.PP
Definition at line 322 of file agent_handler.c.
.PP
References netsnmp_handler_registration_s::handler, netsnmp_mib_handler_s::handler_name, netsnmp_mib_handler_s::next, NULL, netsnmp_mib_handler_s::prev, and snmp_log().
.PP
Referenced by netsnmp_inject_handler(), and netsnmp_inject_handler_into_subtree().
.SS "int netsnmp_register_handler (\fBnetsnmp_handler_registration\fP * reginfo)"
.PP
register a handler, as defined by the netsnmp_handler_registration pointer. 
.PP
Definition at line 202 of file agent_handler.c.
.PP
References netsnmp_handler_registration_s::contextName, netsnmp_handler_registration_s::handler, HANDLER_CAN_DEFAULT, HANDLER_CAN_GETBULK, netsnmp_mib_handler_s::handler_name, netsnmp_handler_registration_s::handlerName, netsnmp_handler_registration_s::modes, netsnmp_get_bulk_to_next_handler(), netsnmp_inject_handler(), netsnmp_register_mib(), netsnmp_mib_handler_s::next, NULL, netsnmp_handler_registration_s::priority, netsnmp_handler_registration_s::range_subid, netsnmp_handler_registration_s::range_ubound, netsnmp_handler_registration_s::rootoid, netsnmp_handler_registration_s::rootoid_len, snmp_log(), and netsnmp_handler_registration_s::timeout.
.PP
Referenced by netsnmp_cache_handler_register(), netsnmp_register_cache_handler(), netsnmp_register_old_api(), netsnmp_register_row_merge(), netsnmp_register_serialize(), netsnmp_register_table(), and netsnmp_sparse_table_register().
.SS "void netsnmp_register_handler_by_name (const char * name, \fBnetsnmp_mib_handler\fP * handler)"
.PP
registers a given handler by name so that it can be found easily later. 
.PP
Definition at line 880 of file agent_handler.c.
.PP
References handler_free_callback(), netsnmp_add_list_data(), and netsnmp_create_data_list().
.PP
Referenced by netsnmp_baby_steps_handler_init(), netsnmp_init_bulk_to_next_helper(), netsnmp_init_debug_helper(), netsnmp_init_read_only_helper(), netsnmp_init_row_merge(), netsnmp_init_serialize(), and netsnmp_init_stash_cache_helper().
.SS "int netsnmp_register_handler_nocallback (\fBnetsnmp_handler_registration\fP * reginfo)"
.PP
register a handler, as defined by the netsnmp_handler_registration pointer. 
.PP
Definition at line 270 of file agent_handler.c.
.PP
References netsnmp_handler_registration_s::contextName, netsnmp_handler_registration_s::handler, HANDLER_CAN_DEFAULT, netsnmp_mib_handler_s::handler_name, netsnmp_handler_registration_s::modes, netsnmp_register_mib(), netsnmp_mib_handler_s::next, NULL, netsnmp_handler_registration_s::priority, netsnmp_handler_registration_s::range_subid, netsnmp_handler_registration_s::range_ubound, netsnmp_handler_registration_s::rootoid, netsnmp_handler_registration_s::rootoid_len, snmp_log(), and netsnmp_handler_registration_s::timeout.
.SS "NETSNMP_INLINE void netsnmp_request_add_list_data (\fBnetsnmp_request_info\fP * request, \fBnetsnmp_data_list\fP * node)"
.PP
add data to a request that can be extracted later by submodules 
.PP
\fBParameters:\fP
.RS 4
\fIrequest\fP the netsnmp request info structure
.br
\fInode\fP this is the data to be added to the linked list request->parent_data
.RE
.PP
\fBReturns:\fP
.RS 4
void 
.RE
.PP

.PP
\fBExamples: \fP
.in +1c
\fBdelayed_instance.c\fP.
.PP
Definition at line 755 of file agent_handler.c.
.PP
References netsnmp_add_list_data(), and netsnmp_request_info_s::parent_data.
.PP
Referenced by netsnmp_insert_iterator_context(), netsnmp_insert_table_row(), netsnmp_instance_int_handler(), netsnmp_instance_long_handler(), netsnmp_instance_ulong_handler(), netsnmp_table_data_helper_handler(), netsnmp_table_data_set_helper_handler(), netsnmp_table_iterator_helper_handler(), netsnmp_watcher_helper_handler(), and table_helper_handler().
.SS "NETSNMP_INLINE void * netsnmp_request_get_list_data (\fBnetsnmp_request_info\fP * request, const char * name)"
.PP
extract data from a request that was added previously by a parent module 
.PP
\fBParameters:\fP
.RS 4
\fIrequest\fP the netsnmp request info function
.br
\fIname\fP used to compare against the request->parent_data->name value, if a match is found request->parent_data->data is returned
.RE
.PP
\fBReturns:\fP
.RS 4
a void pointer(request->parent_data->data), otherwise NULL is returned if request is NULL or request->parent_data is NULL or request->parent_data object is not found. 
.RE
.PP

.PP
\fBExamples: \fP
.in +1c
\fBdelayed_instance.c\fP.
.PP
Definition at line 797 of file agent_handler.c.
.PP
References netsnmp_get_list_data(), NULL, and netsnmp_request_info_s::parent_data.
.PP
Referenced by netsnmp_extract_array_context(), netsnmp_extract_iterator_context(), netsnmp_extract_table(), netsnmp_extract_table_data_set(), netsnmp_extract_table_info(), netsnmp_extract_table_row(), netsnmp_instance_int_handler(), netsnmp_instance_long_handler(), netsnmp_instance_ulong_handler(), and netsnmp_watcher_helper_handler().
.SS "NETSNMP_INLINE int netsnmp_request_remove_list_data (\fBnetsnmp_request_info\fP * request, const char * name)"
.PP
remove data from a request 
.PP
\fBParameters:\fP
.RS 4
\fIrequest\fP the netsnmp request info structure
.br
\fIname\fP this is the name of the previously added data
.RE
.PP
\fBReturns:\fP
.RS 4
0 on successful find-and-delete, 1 otherwise. 
.RE
.PP

.PP
Definition at line 776 of file agent_handler.c.
.PP
References netsnmp_remove_list_node(), NULL, and netsnmp_request_info_s::parent_data.
.SS "int netsnmp_unregister_handler (\fBnetsnmp_handler_registration\fP * reginfo)"
.PP
unregister a handler, as defined by the netsnmp_handler_registration pointer. 
.PP
Definition at line 260 of file agent_handler.c.
.PP
References netsnmp_handler_registration_s::contextName, netsnmp_handler_registration_s::priority, netsnmp_handler_registration_s::range_subid, netsnmp_handler_registration_s::range_ubound, netsnmp_handler_registration_s::rootoid, netsnmp_handler_registration_s::rootoid_len, and unregister_mib_context().