Debian Codegraph @

agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface.c

raw
1 /*
2 * Note: this file originally auto-generated by mib2c using
3 * version : 1.67 $ of : mfd-interface.m2c,v $
4 *
5 * $Id$
6 */
7 /*
8 * *********************************************************************
9 * *********************************************************************
10 * *********************************************************************
11 * *** ***
12 * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
13 * *** ***
14 * *** ***
15 * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
16 * *** ***
17 * *** ***
18 * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
19 * *** ***
20 * *** ***
21 * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
22 * *** ***
23 * *** ***
24 * *********************************************************************
25 * *********************************************************************
26 * *********************************************************************
27 */
28
29 /*
30 * standard Net-SNMP includes
31 */
32 #include <net-snmp/net-snmp-config.h>
33 #include <net-snmp/net-snmp-features.h>
34 #include <net-snmp/net-snmp-includes.h>
35 #include <net-snmp/agent/net-snmp-agent-includes.h>
36
37 /*
38 * include our parent header
39 */
40 #include "ipv4InterfaceTable.h"
41
42
43 #include <net-snmp/agent/table_container.h>
44 #include <net-snmp/library/container.h>
45
46 #include "ipv4InterfaceTable_interface.h"
47
48 #include "if-mib/ifTable/ifTable.h"
49
50 #include <ctype.h>
51
52 netsnmp_feature_require(row_merge);
53 netsnmp_feature_require(baby_steps);
54 netsnmp_feature_require(check_all_requests_error);
55
56 /**********************************************************************
57 **********************************************************************
58 ***
59 *** Table ipv4InterfaceTable
60 ***
61 **********************************************************************
62 **********************************************************************/
63 /*
64 * IP-MIB::ipv4InterfaceTable is subid 28 of ip.
65 * Its status is Current.
66 * OID: .1.3.6.1.2.1.4.28, length: 8
67 */
68 typedef struct ipv4InterfaceTable_interface_ctx_s {
69
70 netsnmp_container *container;
71
72 ipv4InterfaceTable_registration *user_ctx;
73
74 netsnmp_table_registration_info tbl_info;
75
76 netsnmp_baby_steps_access_methods access_multiplexer;
77
78 u_long last_changed;
79
80 } ipv4InterfaceTable_interface_ctx;
81
82 static ipv4InterfaceTable_interface_ctx ipv4InterfaceTable_if_ctx;
83
84 static void
85 _ipv4InterfaceTable_container_init(ipv4InterfaceTable_interface_ctx *
86 if_ctx);
87 static void
88 _ipv4InterfaceTable_container_shutdown(ipv4InterfaceTable_interface_ctx *
89 if_ctx);
90
91
92 netsnmp_container *
93 ipv4InterfaceTable_container_get(void)
94 {
95 return ipv4InterfaceTable_if_ctx.container;
96 }
97
98 ipv4InterfaceTable_registration *
99 ipv4InterfaceTable_registration_get(void)
100 {
101 return ipv4InterfaceTable_if_ctx.user_ctx;
102 }
103
104 ipv4InterfaceTable_registration *
105 ipv4InterfaceTable_registration_set(ipv4InterfaceTable_registration *
106 newreg)
107 {
108 ipv4InterfaceTable_registration *old =
109 ipv4InterfaceTable_if_ctx.user_ctx;
110 ipv4InterfaceTable_if_ctx.user_ctx = newreg;
111 return old;
112 }
113
114 int
115 ipv4InterfaceTable_container_size(void)
116 {
117 return CONTAINER_SIZE(ipv4InterfaceTable_if_ctx.container);
118 }
119
120 u_int
121 ipv4InterfaceTable_dirty_get(void)
122 {
123 return ifTable_dirty_get();
124 }
125
126 void
127 ipv4InterfaceTable_dirty_set(u_int status)
128 {
129 ifTable_dirty_set(status);
130 }
131
132 /*
133 * ipv4InterfaceTableLastChanged, which is the last time that a row in
134 * the table was changed or the last time a row was added/deleted from the
135 * table.
136 */
137 void
138 ipv4InterfaceTable_lastChange_set(u_long table_changed)
139 {
140 DEBUGMSGTL(("ipv4InterfaceTable:lastChanged_set",
141 "called. was %ld, now %ld\n",
142 ipv4InterfaceTable_if_ctx.last_changed, table_changed));
143 ipv4InterfaceTable_if_ctx.last_changed = table_changed;
144 }
145
146 /*
147 * mfd multiplexer modes
148 */
149 static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_pre_request;
150 static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_post_request;
151 static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_object_lookup;
152 static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_get_values;
153 #ifndef NETSNMP_DISABLE_SET_SUPPORT
154 static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_check_objects;
155 static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_undo_setup;
156 static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_set_values;
157 static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_undo_cleanup;
158 static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_undo_values;
159 static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_commit;
160 static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_undo_commit;
161 static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_irreversible_commit;
162
163 NETSNMP_STATIC_INLINE int
164 _ipv4InterfaceTable_undo_column(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,
165 netsnmp_variable_list *
166 var, int column);
167 #endif
168
169 /**
170 * @internal
171 * Initialize the table ipv4InterfaceTable
172 * (Define its contents and how it's structured)
173 */
174 void
175 _ipv4InterfaceTable_initialize_interface(ipv4InterfaceTable_registration *
176 reg_ptr, u_long flags)
177 {
178 netsnmp_baby_steps_access_methods *access_multiplexer =
179 &ipv4InterfaceTable_if_ctx.access_multiplexer;
180 netsnmp_table_registration_info *tbl_info =
181 &ipv4InterfaceTable_if_ctx.tbl_info;
182 netsnmp_handler_registration *reginfo;
183 netsnmp_mib_handler *handler;
184 int mfd_modes = 0;
185
186 DEBUGMSGTL(("internal:ipv4InterfaceTable:_ipv4InterfaceTable_initialize_interface", "called\n"));
187
188
189 /*************************************************
190 *
191 * save interface context for ipv4InterfaceTable
192 */
193 /*
194 * Setting up the table's definition
195 */
196 netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,
197 /** index: ipv4InterfaceIfIndex */
198 0);
199
200 /*
201 * Define the minimum and maximum accessible columns. This
202 * optimizes retrieval.
203 */
204 tbl_info->min_column = IPV4INTERFACETABLE_MIN_COL;
205 tbl_info->max_column = IPV4INTERFACETABLE_MAX_COL;
206
207 /*
208 * save users context
209 */
210 ipv4InterfaceTable_if_ctx.user_ctx = reg_ptr;
211
212 /*
213 * call data access initialization code
214 */
215 ipv4InterfaceTable_init_data(reg_ptr);
216
217 /*
218 * set up the container
219 */
220 _ipv4InterfaceTable_container_init(&ipv4InterfaceTable_if_ctx);
221 if (NULL == ipv4InterfaceTable_if_ctx.container) {
222 snmp_log(LOG_ERR,
223 "could not initialize container for ipv4InterfaceTable\n");
224 return;
225 }
226
227 /*
228 * access_multiplexer: REQUIRED wrapper for get request handling
229 */
230 access_multiplexer->object_lookup =
231 _mfd_ipv4InterfaceTable_object_lookup;
232 access_multiplexer->get_values = _mfd_ipv4InterfaceTable_get_values;
233
234 /*
235 * no wrappers yet
236 */
237 access_multiplexer->pre_request = _mfd_ipv4InterfaceTable_pre_request;
238 access_multiplexer->post_request =
239 _mfd_ipv4InterfaceTable_post_request;
240
241
242 #ifndef NETSNMP_DISABLE_SET_SUPPORT
243 /*
244 * REQUIRED wrappers for set request handling
245 */
246 access_multiplexer->object_syntax_checks =
247 _mfd_ipv4InterfaceTable_check_objects;
248 access_multiplexer->undo_setup = _mfd_ipv4InterfaceTable_undo_setup;
249 access_multiplexer->undo_cleanup =
250 _mfd_ipv4InterfaceTable_undo_cleanup;
251 access_multiplexer->set_values = _mfd_ipv4InterfaceTable_set_values;
252 access_multiplexer->undo_sets = _mfd_ipv4InterfaceTable_undo_values;
253
254 /*
255 * no wrappers yet
256 */
257 access_multiplexer->commit = _mfd_ipv4InterfaceTable_commit;
258 access_multiplexer->undo_commit = _mfd_ipv4InterfaceTable_undo_commit;
259 access_multiplexer->irreversible_commit =
260 _mfd_ipv4InterfaceTable_irreversible_commit;
261 #endif
262
263 /*************************************************
264 *
265 * Create a registration, save our reg data, register table.
266 */
267 DEBUGMSGTL(("ipv4InterfaceTable:init_ipv4InterfaceTable",
268 "Registering ipv4InterfaceTable as a mibs-for-dummies table.\n"));
269 handler =
270 netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
271 reginfo =
272 netsnmp_handler_registration_create("ipv4InterfaceTable", handler,
273 ipv4InterfaceTable_oid,
274 ipv4InterfaceTable_oid_size,
275 HANDLER_CAN_BABY_STEP |
276 #ifndef NETSNMP_DISABLE_SET_SUPPORT
277 HANDLER_CAN_RWRITE
278 #else
279 HANDLER_CAN_RONLY
280 #endif /* NETSNMP_DISABLE_SET_SUPPORT */
281 );
282 if (NULL == reginfo) {
283 snmp_log(LOG_ERR, "error registering table ipv4InterfaceTable\n");
284 return;
285 }
286 reginfo->my_reg_void = &ipv4InterfaceTable_if_ctx;
287
288 /*************************************************
289 *
290 * set up baby steps handler, create it and inject it
291 */
292 if (access_multiplexer->object_lookup)
293 mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
294 if (access_multiplexer->pre_request)
295 mfd_modes |= BABY_STEP_PRE_REQUEST;
296 if (access_multiplexer->post_request)
297 mfd_modes |= BABY_STEP_POST_REQUEST;
298
299 #ifndef NETSNMP_DISABLE_SET_SUPPORT
300 if (access_multiplexer->set_values)
301 mfd_modes |= BABY_STEP_SET_VALUES;
302 if (access_multiplexer->irreversible_commit)
303 mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
304 if (access_multiplexer->object_syntax_checks)
305 mfd_modes |= BABY_STEP_CHECK_OBJECT;
306
307 if (access_multiplexer->undo_setup)
308 mfd_modes |= BABY_STEP_UNDO_SETUP;
309 if (access_multiplexer->undo_cleanup)
310 mfd_modes |= BABY_STEP_UNDO_CLEANUP;
311 if (access_multiplexer->undo_sets)
312 mfd_modes |= BABY_STEP_UNDO_SETS;
313
314 if (access_multiplexer->row_creation)
315 mfd_modes |= BABY_STEP_ROW_CREATE;
316 if (access_multiplexer->consistency_checks)
317 mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
318 if (access_multiplexer->commit)
319 mfd_modes |= BABY_STEP_COMMIT;
320 if (access_multiplexer->undo_commit)
321 mfd_modes |= BABY_STEP_UNDO_COMMIT;
322 #endif
323
324 handler = netsnmp_baby_steps_handler_get(mfd_modes);
325 netsnmp_inject_handler(reginfo, handler);
326
327 /*************************************************
328 *
329 * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
330 */
331 handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
332 netsnmp_inject_handler(reginfo, handler);
333
334 /*************************************************
335 *
336 * inject container_table helper
337 */
338 handler =
339 netsnmp_container_table_handler_get(tbl_info,
340 ipv4InterfaceTable_if_ctx.
341 container,
342 TABLE_CONTAINER_KEY_NETSNMP_INDEX);
343 netsnmp_inject_handler(reginfo, handler);
344
345 /*
346 * register table
347 */
348 netsnmp_register_table(reginfo, tbl_info);
349
350 /*
351 * register LastChanged
352 */
353 {
354 oid lc_oid[] = { IPV4INTERFACETABLELASTCHANGE_OID };
355 netsnmp_register_watched_scalar2(netsnmp_create_handler_registration
356 ("ipv4TableLastChanged", NULL,
357 lc_oid, OID_LENGTH(lc_oid),
358 HANDLER_CAN_RONLY),
359 netsnmp_create_watcher_info((void
360 *)
361 &ipv4InterfaceTable_if_ctx.
362 last_changed,
363 sizeof
364 (u_long),
365 ASN_TIMETICKS,
366 WATCHER_FIXED_SIZE));
367 }
368 } /* _ipv4InterfaceTable_initialize_interface */
369
370 /**
371 * @internal
372 * Shutdown the table ipv4InterfaceTable
373 */
374 void
375 _ipv4InterfaceTable_shutdown_interface(ipv4InterfaceTable_registration *
376 reg_ptr)
377 {
378 /*
379 * shutdown the container
380 */
381 _ipv4InterfaceTable_container_shutdown(&ipv4InterfaceTable_if_ctx);
382 }
383
384 void
385 ipv4InterfaceTable_valid_columns_set(netsnmp_column_info *vc)
386 {
387 ipv4InterfaceTable_if_ctx.tbl_info.valid_columns = vc;
388 } /* ipv4InterfaceTable_valid_columns_set */
389
390 #if 0
391 /*
392 * ipv4InterfaceTable_allocate_data
393 *
394 * Purpose: create new ipv4InterfaceTable_data.
395 */
396 ipv4InterfaceTable_data *
397 ipv4InterfaceTable_allocate_data(void)
398 {
399 ipv4InterfaceTable_data *rtn =
400 SNMP_MALLOC_TYPEDEF(ipv4InterfaceTable_data);
401
402 DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_allocate_data", "called\n"));
403
404 if (NULL == rtn) {
405 snmp_log(LOG_ERR, "unable to malloc memory for new "
406 "ipv4InterfaceTable_data.\n");
407 }
408
409 return rtn;
410 } /* ipv4InterfaceTable_allocate_data */
411 #endif
412
413 /**
414 * @internal
415 * wrapper
416 */
417 static int
418 _mfd_ipv4InterfaceTable_pre_request(netsnmp_mib_handler *handler,
419 netsnmp_handler_registration *reginfo,
420 netsnmp_agent_request_info
421 *agtreq_info,
422 netsnmp_request_info *requests)
423 {
424 int rc;
425
426 DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_pre_request", "called\n"));
427
428 if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
429 DEBUGMSGTL(("internal:ipv4InterfaceTable",
430 "skipping additional pre_request\n"));
431 return SNMP_ERR_NOERROR;
432 }
433
434 rc = ipv4InterfaceTable_pre_request(ipv4InterfaceTable_if_ctx.
435 user_ctx);
436 if (MFD_SUCCESS != rc) {
437 /*
438 * nothing we can do about it but log it
439 */
440 DEBUGMSGTL(("ipv4InterfaceTable", "error %d from "
441 "ipv4InterfaceTable_pre_request\n", rc));
442 netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
443 }
444
445 return SNMP_ERR_NOERROR;
446 } /* _mfd_ipv4InterfaceTable_pre_request */
447
448 /**
449 * @internal
450 * wrapper
451 */
452 static int
453 _mfd_ipv4InterfaceTable_post_request(netsnmp_mib_handler *handler,
454 netsnmp_handler_registration *reginfo,
455 netsnmp_agent_request_info
456 *agtreq_info,
457 netsnmp_request_info *requests)
458 {
459 int rc, packet_rc;
460
461 DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_post_request", "called\n"));
462
463 /*
464 * wait for last call before calling user
465 */
466 if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
467 DEBUGMSGTL(("internal:ipv4InterfaceTable",
468 "waiting for last post_request\n"));
469 return SNMP_ERR_NOERROR;
470 }
471
472 packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
473 if ((MFD_SUCCESS != packet_rc) && ipv4InterfaceTable_dirty_get()) {
474 /*
475 * we shouldn't get here. the undo steps should also clear
476 * the dirty flags.
477 */
478 snmp_log(LOG_WARNING,
479 "ipv4InterfaceTable dirty flag set in post_request "
480 "but status != SUCCESS.\n");
481 }
482
483 rc = ipv4InterfaceTable_post_request(ipv4InterfaceTable_if_ctx.
484 user_ctx, packet_rc);
485 if (MFD_SUCCESS != rc) {
486 /*
487 * nothing we can do about it but log it
488 */
489 DEBUGMSGTL(("ipv4InterfaceTable", "error %d from "
490 "ipv4InterfaceTable_post_request\n", rc));
491 }
492
493 return SNMP_ERR_NOERROR;
494 } /* _mfd_ipv4InterfaceTable_post_request */
495
496 /**
497 * @internal
498 * wrapper
499 */
500 static int
501 _mfd_ipv4InterfaceTable_object_lookup(netsnmp_mib_handler *handler, netsnmp_handler_registration
502 *reginfo, netsnmp_agent_request_info
503 *agtreq_info,
504 netsnmp_request_info *requests)
505 {
506 int rc = SNMP_ERR_NOERROR;
507 ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
508 netsnmp_container_table_row_extract(requests);
509
510 DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_object_lookup", "called\n"));
511
512 /*
513 * get our context from mfd
514 * ipv4InterfaceTable_interface_ctx *if_ctx =
515 * (ipv4InterfaceTable_interface_ctx *)reginfo->my_reg_void;
516 */
517
518 if (NULL == rowreq_ctx) {
519 rc = SNMP_ERR_NOCREATION;
520 }
521
522 if (MFD_SUCCESS != rc)
523 netsnmp_request_set_error_all(requests, rc);
524 else
525 ipv4InterfaceTable_row_prep(rowreq_ctx);
526
527 return SNMP_VALIDATE_ERR(rc);
528 } /* _mfd_ipv4InterfaceTable_object_lookup */
529
530 /***********************************************************************
531 *
532 * GET processing
533 *
534 ***********************************************************************/
535 /*
536 * @internal
537 * Retrieve the value for a particular column
538 */
539 NETSNMP_STATIC_INLINE int
540 _ipv4InterfaceTable_get_column(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,
541 netsnmp_variable_list * var, int column)
542 {
543 int rc = SNMPERR_SUCCESS;
544
545 DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_get_column", "called for %d\n", column));
546
547
548 netsnmp_assert(NULL != rowreq_ctx);
549
550 switch (column) {
551
552 /*
553 * ipv4InterfaceReasmMaxSize(2)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
554 */
555 case COLUMN_IPV4INTERFACEREASMMAXSIZE:
556 var->val_len = sizeof(long);
557 var->type = ASN_INTEGER;
558 rc = ipv4InterfaceReasmMaxSize_get(rowreq_ctx,
559 (long *) var->val.string);
560 break;
561
562 /*
563 * ipv4InterfaceEnableStatus(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
564 */
565 case COLUMN_IPV4INTERFACEENABLESTATUS:
566 var->val_len = sizeof(u_long);
567 var->type = ASN_INTEGER;
568 rc = ipv4InterfaceEnableStatus_get(rowreq_ctx,
569 (u_long *) var->val.string);
570 break;
571
572 /*
573 * ipv4InterfaceRetransmitTime(4)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/D/h
574 */
575 case COLUMN_IPV4INTERFACERETRANSMITTIME:
576 var->val_len = sizeof(u_long);
577 var->type = ASN_UNSIGNED;
578 rc = ipv4InterfaceRetransmitTime_get(rowreq_ctx,
579 (u_long *) var->val.string);
580 break;
581
582 default:
583 snmp_log(LOG_ERR,
584 "unknown column %d in _ipv4InterfaceTable_get_column\n",
585 column);
586 break;
587 }
588
589 return rc;
590 } /* _ipv4InterfaceTable_get_column */
591
592 int
593 _mfd_ipv4InterfaceTable_get_values(netsnmp_mib_handler *handler,
594 netsnmp_handler_registration *reginfo,
595 netsnmp_agent_request_info *agtreq_info,
596 netsnmp_request_info *requests)
597 {
598 ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
599 netsnmp_container_table_row_extract(requests);
600 netsnmp_table_request_info *tri;
601 u_char *old_string;
602 void (*dataFreeHook) (void *);
603 int rc;
604
605 DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_get_values", "called\n"));
606
607 netsnmp_assert(NULL != rowreq_ctx);
608
609 for (; requests; requests = requests->next) {
610 /*
611 * save old pointer, so we can free it if replaced
612 */
613 old_string = requests->requestvb->val.string;
614 dataFreeHook = requests->requestvb->dataFreeHook;
615 if (NULL == requests->requestvb->val.string) {
616 requests->requestvb->val.string = requests->requestvb->buf;
617 requests->requestvb->val_len =
618 sizeof(requests->requestvb->buf);
619 } else if (requests->requestvb->buf ==
620 requests->requestvb->val.string) {
621 if (requests->requestvb->val_len !=
622 sizeof(requests->requestvb->buf))
623 requests->requestvb->val_len =
624 sizeof(requests->requestvb->buf);
625 }
626
627 /*
628 * get column data
629 */
630 tri = netsnmp_extract_table_info(requests);
631 if (NULL == tri)
632 continue;
633
634 rc = _ipv4InterfaceTable_get_column(rowreq_ctx,
635 requests->requestvb,
636 tri->colnum);
637 if (rc) {
638 if (MFD_SKIP == rc) {
639 requests->requestvb->type = SNMP_NOSUCHINSTANCE;
640 rc = SNMP_ERR_NOERROR;
641 }
642 } else if (NULL == requests->requestvb->val.string) {
643 snmp_log(LOG_ERR, "NULL varbind data pointer!\n");
644 rc = SNMP_ERR_GENERR;
645 }
646 if (rc)
647 netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
648
649 /*
650 * if the buffer wasn't used previously for the old data (i.e. it
651 * was allocated memory) and the get routine replaced the pointer,
652 * we need to free the previous pointer.
653 */
654 if (old_string && (old_string != requests->requestvb->buf) &&
655 (requests->requestvb->val.string != old_string)) {
656 if (dataFreeHook)
657 (*dataFreeHook) (old_string);
658 else
659 free(old_string);
660 }
661 } /* for results */
662
663 return SNMP_ERR_NOERROR;
664 } /* _mfd_ipv4InterfaceTable_get_values */
665
666
667 #ifndef NETSNMP_DISABLE_SET_SUPPORT
668 /***********************************************************************
669 *
670 * SET processing
671 *
672 ***********************************************************************/
673
674 /*----------------------------------------------------------------------
675 *
676 * SET: Syntax checks
677 *
678 *---------------------------------------------------------------------*/
679 /*
680 * @internal
681 * Check the syntax for a particular column
682 */
683 NETSNMP_STATIC_INLINE int
684 _ipv4InterfaceTable_check_column(ipv4InterfaceTable_rowreq_ctx *
685 rowreq_ctx, netsnmp_variable_list * var,
686 int column)
687 {
688 int rc = SNMPERR_SUCCESS;
689
690 DEBUGMSGTL(("internal:ipv4InterfaceTable:_ipv4InterfaceTable_check_column", "called for %d\n", column));
691
692 netsnmp_assert(NULL != rowreq_ctx);
693
694 switch (column) {
695 /*
696 * (INDEX) ipv4InterfaceIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
697 */
698 case COLUMN_IPV4INTERFACEIFINDEX:
699 rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
700 break;
701
702 /*
703 * ipv4InterfaceReasmMaxSize(2)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
704 */
705 case COLUMN_IPV4INTERFACEREASMMAXSIZE:
706 rc = SNMP_ERR_NOTWRITABLE;
707 break;
708
709 /*
710 * ipv4InterfaceEnableStatus(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
711 */
712 case COLUMN_IPV4INTERFACEENABLESTATUS:
713 rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
714 sizeof(rowreq_ctx->data.
715 ipv4InterfaceEnableStatus));
716 /*
717 * check that the value is one of defined enums
718 */
719 if ((SNMPERR_SUCCESS == rc)
720 && (*var->val.integer != IPV4INTERFACEENABLESTATUS_UP)
721 && (*var->val.integer != IPV4INTERFACEENABLESTATUS_DOWN)
722 ) {
723 rc = SNMP_ERR_WRONGVALUE;
724 }
725 if (SNMPERR_SUCCESS != rc) {
726 DEBUGMSGTL(("ipv4InterfaceTable:_ipv4InterfaceTable_check_column:ipv4InterfaceEnableStatus", "varbind validation failed (eg bad type or size)\n"));
727 } else {
728 rc = ipv4InterfaceEnableStatus_check_value(rowreq_ctx,
729 *((u_long *) var->
730 val.string));
731 if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
732 && (MFD_NOT_VALID_NOW != rc)) {
733 snmp_log(LOG_ERR,
734 "bad rc %d from ipv4InterfaceEnableStatus_check_value\n",
735 rc);
736 rc = SNMP_ERR_GENERR;
737 }
738 }
739 break;
740
741 /*
742 * ipv4InterfaceRetransmitTime(4)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/D/h
743 */
744 case COLUMN_IPV4INTERFACERETRANSMITTIME:
745 rc = SNMP_ERR_NOTWRITABLE;
746 break;
747
748 default: /** We shouldn't get here */
749 rc = SNMP_ERR_GENERR;
750 snmp_log(LOG_ERR,
751 "unknown column %d in _ipv4InterfaceTable_check_column\n",
752 column);
753 }
754
755 return rc;
756 } /* _ipv4InterfaceTable_check_column */
757
758 int
759 _mfd_ipv4InterfaceTable_check_objects(netsnmp_mib_handler *handler, netsnmp_handler_registration
760 *reginfo, netsnmp_agent_request_info
761 *agtreq_info,
762 netsnmp_request_info *requests)
763 {
764 ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
765 netsnmp_container_table_row_extract(requests);
766 netsnmp_table_request_info *tri;
767 int rc;
768
769 DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_check_objects", "called\n"));
770
771 netsnmp_assert(NULL != rowreq_ctx);
772
773 for (; requests; requests = requests->next) {
774
775 /*
776 * get column number from table request info, and check that column
777 */
778 tri = netsnmp_extract_table_info(requests);
779 if (NULL == tri)
780 continue;
781
782 rc = _ipv4InterfaceTable_check_column(rowreq_ctx,
783 requests->requestvb,
784 tri->colnum);
785 if (rc) {
786 netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
787 break;
788 }
789
790 } /* for results */
791
792 return SNMP_ERR_NOERROR;
793 } /* _mfd_ipv4InterfaceTable_check_objects */
794
795
796 /*----------------------------------------------------------------------
797 *
798 * SET: Undo setup
799 *
800 *---------------------------------------------------------------------*/
801 /*
802 * @internal
803 * Set the value for a particular column
804 */
805 NETSNMP_STATIC_INLINE int
806 _ipv4InterfaceTable_undo_setup_column(ipv4InterfaceTable_rowreq_ctx *
807 rowreq_ctx, int column)
808 {
809 int rc = SNMPERR_SUCCESS;
810
811 DEBUGMSGTL(("internal:ipv4InterfaceTable:_ipv4InterfaceTable_undo_setup_column", "called for %d\n", column));
812
813 netsnmp_assert(NULL != rowreq_ctx);
814
815 switch (column) {
816
817 /*
818 * ipv4InterfaceEnableStatus(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
819 */
820 case COLUMN_IPV4INTERFACEENABLESTATUS:
821 rowreq_ctx->column_set_flags |=
822 COLUMN_IPV4INTERFACEENABLESTATUS_FLAG;
823 rc = ipv4InterfaceEnableStatus_undo_setup(rowreq_ctx);
824 break;
825
826 default:
827 snmp_log(LOG_ERR,
828 "unknown column %d in _ipv4InterfaceTable_undo_setup_column\n",
829 column);
830 break;
831 }
832
833 return rc;
834 } /* _ipv4InterfaceTable_undo_setup_column */
835
836
837 /**
838 * @internal
839 * undo setup
840 */
841 int
842 _mfd_ipv4InterfaceTable_undo_setup(netsnmp_mib_handler *handler,
843 netsnmp_handler_registration *reginfo,
844 netsnmp_agent_request_info *agtreq_info,
845 netsnmp_request_info *requests)
846 {
847 int rc;
848 ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
849 netsnmp_container_table_row_extract(requests);
850
851 DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_undo_setup", "called\n"));
852
853 netsnmp_assert(NULL != rowreq_ctx);
854
855 /*
856 * allocate undo context
857 */
858 rc = _mfd_ifTable_undo_setup_allocate(rowreq_ctx);
859 if (MFD_SUCCESS != rc) {
860 netsnmp_request_set_error_all(requests, rc);
861 return SNMP_ERR_NOERROR;
862 }
863
864 /*
865 * row undo setup
866 */
867 rc = ipv4InterfaceTable_undo_setup(rowreq_ctx);
868 if (MFD_SUCCESS != rc) {
869 DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from "
870 "ipv4InterfaceTable_undo_setup\n", rc));
871 netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
872 } else {
873 /*
874 * column undo setup
875 */
876 netsnmp_table_request_info *tri;
877 for (; requests; requests = requests->next) {
878 /*
879 * set column data
880 */
881 tri = netsnmp_extract_table_info(requests);
882 if (NULL == tri)
883 continue;
884
885 rc = _ipv4InterfaceTable_undo_setup_column(rowreq_ctx,
886 tri->colnum);
887 if (MFD_SUCCESS != rc) {
888 DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from "
889 "ipv4InterfaceTable_undo_setup_column\n", rc));
890 netsnmp_set_request_error(agtreq_info, requests,
891 SNMP_VALIDATE_ERR(rc));
892 }
893 } /* for results */
894 }
895
896 return SNMP_ERR_NOERROR;
897 } /* _mfd_ipv4InterfaceTable_undo_setup */
898
899 /**
900 * @internal
901 * undo setup
902 */
903 int
904 _mfd_ipv4InterfaceTable_undo_cleanup(netsnmp_mib_handler *handler,
905 netsnmp_handler_registration *reginfo,
906 netsnmp_agent_request_info
907 *agtreq_info,
908 netsnmp_request_info *requests)
909 {
910 ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
911 netsnmp_container_table_row_extract(requests);
912 int rc;
913
914 DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_undo_cleanup", "called\n"));
915
916 /*
917 * failed row create in early stages has no rowreq_ctx
918 */
919 if (NULL == rowreq_ctx)
920 return MFD_SUCCESS;
921
922 /*
923 * call user cleanup
924 */
925 rc = ipv4InterfaceTable_undo_cleanup(rowreq_ctx);
926 if (MFD_SUCCESS != rc) {
927 /*
928 * nothing we can do about it but log it
929 */
930 DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from "
931 "ipv4InterfaceTable_undo_cleanup\n", rc));
932 }
933
934 /*
935 * release undo context, if needed
936 */
937 _mfd_ifTable_undo_setup_release(rowreq_ctx);
938
939 return SNMP_ERR_NOERROR;
940 } /* _mfd_ipv4InterfaceTable_undo_cleanup */
941
942 /*----------------------------------------------------------------------
943 *
944 * SET: Set values
945 *
946 *---------------------------------------------------------------------*/
947 /*
948 * @internal
949 * Set the value for a particular column
950 */
951 NETSNMP_STATIC_INLINE int
952 _ipv4InterfaceTable_set_column(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,
953 netsnmp_variable_list * var, int column)
954 {
955 int rc = SNMPERR_SUCCESS;
956
957 DEBUGMSGTL(("internal:ipv4InterfaceTable:_ipv4InterfaceTable_set_column", "called for %d\n", column));
958
959 netsnmp_assert(NULL != rowreq_ctx);
960
961 switch (column) {
962
963 /*
964 * ipv4InterfaceEnableStatus(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
965 */
966 case COLUMN_IPV4INTERFACEENABLESTATUS:
967 rowreq_ctx->column_set_flags |=
968 COLUMN_IPV4INTERFACEENABLESTATUS_FLAG;
969 rc = ipv4InterfaceEnableStatus_set(rowreq_ctx,
970 *((u_long *) var->val.string));
971 break;
972
973 default:
974 snmp_log(LOG_ERR,
975 "unknown column %d in _ipv4InterfaceTable_set_column\n",
976 column);
977 rc = SNMP_ERR_GENERR;
978 break;
979 }
980
981 return rc;
982 } /* _ipv4InterfaceTable_set_column */
983
984 int
985 _mfd_ipv4InterfaceTable_set_values(netsnmp_mib_handler *handler,
986 netsnmp_handler_registration *reginfo,
987 netsnmp_agent_request_info *agtreq_info,
988 netsnmp_request_info *requests)
989 {
990 ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
991 netsnmp_container_table_row_extract(requests);
992 netsnmp_table_request_info *tri;
993 int rc = SNMP_ERR_NOERROR;
994
995 DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_set_values", "called\n"));
996
997 netsnmp_assert(NULL != rowreq_ctx);
998
999 rowreq_ctx->column_set_flags = 0;
1000 for (; requests; requests = requests->next) {
1001 /*
1002 * set column data
1003 */
1004 tri = netsnmp_extract_table_info(requests);
1005 if (NULL == tri)
1006 continue;
1007
1008 rc = _ipv4InterfaceTable_set_column(rowreq_ctx,
1009 requests->requestvb,
1010 tri->colnum);
1011 if (MFD_SUCCESS != rc) {
1012 DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from "
1013 "ipv4InterfaceTable_set_column\n", rc));
1014 netsnmp_set_request_error(agtreq_info, requests,
1015 SNMP_VALIDATE_ERR(rc));
1016 }
1017 } /* for results */
1018
1019 return SNMP_ERR_NOERROR;
1020 } /* _mfd_ipv4InterfaceTable_set_values */
1021
1022 /*----------------------------------------------------------------------
1023 *
1024 * SET: commit
1025 *
1026 *---------------------------------------------------------------------*/
1027 /**
1028 * @internal
1029 * commit the values
1030 */
1031 int
1032 _mfd_ipv4InterfaceTable_commit(netsnmp_mib_handler *handler,
1033 netsnmp_handler_registration *reginfo,
1034 netsnmp_agent_request_info *agtreq_info,
1035 netsnmp_request_info *requests)
1036 {
1037 int rc;
1038 ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
1039 netsnmp_container_table_row_extract(requests);
1040
1041 DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_commit", "called\n"));
1042
1043 netsnmp_assert(NULL != rowreq_ctx);
1044
1045 rc = ipv4InterfaceTable_commit(rowreq_ctx);
1046 if (MFD_SUCCESS != rc) {
1047 DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from "
1048 "ipv4InterfaceTable_commit\n", rc));
1049 netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
1050 }
1051
1052 if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
1053 /*
1054 * if we successfully committed this row, set the dirty flag. Use the
1055 * current value + 1 (i.e. dirty = # rows changed).
1056 * this is checked in post_request...
1057 */
1058 ipv4InterfaceTable_dirty_set(ipv4InterfaceTable_dirty_get() + 1); /* set table dirty flag */
1059 }
1060
1061 return SNMP_ERR_NOERROR;
1062 }
1063
1064 int
1065 _mfd_ipv4InterfaceTable_undo_commit(netsnmp_mib_handler *handler,
1066 netsnmp_handler_registration *reginfo,
1067 netsnmp_agent_request_info
1068 *agtreq_info,
1069 netsnmp_request_info *requests)
1070 {
1071 int rc;
1072 ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
1073 netsnmp_container_table_row_extract(requests);
1074
1075 DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_undo_commit", "called\n"));
1076
1077 netsnmp_assert(NULL != rowreq_ctx);
1078
1079 if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
1080 u_int d = ipv4InterfaceTable_dirty_get();
1081
1082 netsnmp_assert(d != 0);
1083 if (d)
1084 ipv4InterfaceTable_dirty_set(d - 1);
1085 }
1086
1087 rc = ipv4InterfaceTable_undo_commit(rowreq_ctx);
1088 if (MFD_SUCCESS != rc) {
1089 /*
1090 * nothing we can do about it but log it
1091 */
1092 DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from "
1093 "ipv4InterfaceTable_undo_commit\n", rc));
1094 }
1095
1096 if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
1097 snmp_log(LOG_WARNING,
1098 "ipv4InterfaceTable row dirty flag still set after undo_commit\n");
1099 rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
1100 }
1101
1102 return SNMP_ERR_NOERROR;
1103 } /* _mfd_ipv4InterfaceTable_commit */
1104
1105 /*----------------------------------------------------------------------
1106 *
1107 * SET: Undo
1108 *
1109 *---------------------------------------------------------------------*/
1110 /**
1111 * @internal
1112 * undo the value for a particular column
1113 */
1114 NETSNMP_STATIC_INLINE int
1115 _ipv4InterfaceTable_undo_column(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,
1116 netsnmp_variable_list * var, int column)
1117 {
1118 int rc = SNMPERR_SUCCESS;
1119
1120 DEBUGMSGTL(("internal:ipv4InterfaceTable:_ipv4InterfaceTable_undo_column", "called for %d\n", column));
1121
1122 netsnmp_assert(NULL != rowreq_ctx);
1123
1124 switch (column) {
1125
1126 /*
1127 * ipv4InterfaceEnableStatus(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
1128 */
1129 case COLUMN_IPV4INTERFACEENABLESTATUS:
1130 rc = ipv4InterfaceEnableStatus_undo(rowreq_ctx);
1131 break;
1132
1133 default:
1134 snmp_log(LOG_ERR,
1135 "unknown column %d in _ipv4InterfaceTable_undo_column\n",
1136 column);
1137 break;
1138 }
1139
1140 return rc;
1141 } /* _ipv4InterfaceTable_undo_column */
1142
1143 int
1144 _mfd_ipv4InterfaceTable_undo_values(netsnmp_mib_handler *handler,
1145 netsnmp_handler_registration *reginfo,
1146 netsnmp_agent_request_info
1147 *agtreq_info,
1148 netsnmp_request_info *requests)
1149 {
1150 int rc;
1151 ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
1152 netsnmp_container_table_row_extract(requests);
1153 netsnmp_table_request_info *tri;
1154
1155 DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_undo_values", "called\n"));
1156
1157 netsnmp_assert(NULL != rowreq_ctx);
1158
1159 rc = ipv4InterfaceTable_undo(rowreq_ctx);
1160 if (MFD_SUCCESS != rc) {
1161 /*
1162 * nothing we can do about it but log it
1163 */
1164 DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from "
1165 "ipv4InterfaceTable_undo\n", rc));
1166 }
1167
1168 for (; requests; requests = requests->next) {
1169 /*
1170 * set column data
1171 */
1172 tri = netsnmp_extract_table_info(requests);
1173 if (NULL == tri)
1174 continue;
1175
1176 rc = _ipv4InterfaceTable_undo_column(rowreq_ctx,
1177 requests->requestvb,
1178 tri->colnum);
1179 if (MFD_SUCCESS != rc) {
1180 /*
1181 * nothing we can do about it but log it
1182 */
1183 DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from "
1184 "ipv4InterfaceTable_undo_column\n", rc));
1185 }
1186 } /* for results */
1187
1188 return SNMP_ERR_NOERROR;
1189 } /* _mfd_ipv4InterfaceTable_undo_values */
1190
1191 /*----------------------------------------------------------------------
1192 *
1193 * SET: irreversible commit
1194 *
1195 *---------------------------------------------------------------------*/
1196 /**
1197 * @internal
1198 * commit irreversible actions
1199 */
1200 int
1201 _mfd_ipv4InterfaceTable_irreversible_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration
1202 *reginfo, netsnmp_agent_request_info
1203 *agtreq_info,
1204 netsnmp_request_info *requests)
1205 {
1206 ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
1207 netsnmp_container_table_row_extract(requests);
1208
1209 DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_irreversible:commit", "called\n"));
1210
1211 netsnmp_assert(NULL != rowreq_ctx);
1212
1213 /*
1214 * check for and handle row creation/deletion
1215 * and update column exist flags...
1216 */
1217 if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) {
1218 CONTAINER_REMOVE(ipv4InterfaceTable_if_ctx.container, rowreq_ctx);
1219 } else {
1220 if (rowreq_ctx->column_set_flags) {
1221 rowreq_ctx->column_set_flags = 0;
1222 }
1223 }
1224
1225 return SNMP_ERR_NOERROR;
1226 } /* _mfd_ipv4InterfaceTable_irreversible_commit */
1227 #endif
1228
1229 /***********************************************************************
1230 *
1231 * DATA ACCESS
1232 *
1233 ***********************************************************************/
1234 /**
1235 * @internal
1236 */
1237 /**
1238 * @internal
1239 */
1240 static void
1241 _container_free(netsnmp_container *container)
1242 {
1243 DEBUGMSGTL(("internal:ipv4InterfaceTable:_container_free",
1244 "called\n"));
1245
1246 if (NULL == container) {
1247 snmp_log(LOG_ERR,
1248 "invalid container in ipv4InterfaceTable_container_free\n");
1249 return;
1250 }
1251
1252 /*
1253 * call user code
1254 */
1255 ipv4InterfaceTable_container_free(container);
1256 } /* _container_free */
1257
1258 /**
1259 * @internal
1260 * initialize the container with functions or wrappers
1261 */
1262 void
1263 _ipv4InterfaceTable_container_init(ipv4InterfaceTable_interface_ctx *
1264 if_ctx)
1265 {
1266 DEBUGMSGTL(("internal:ipv4InterfaceTable:_ipv4InterfaceTable_container_init", "called\n"));
1267
1268 /*
1269 * container init
1270 */
1271 ipv4InterfaceTable_container_init(&if_ctx->container);
1272 if (NULL == if_ctx->container)
1273 if_ctx->container =
1274 netsnmp_container_find("ipv4InterfaceTable:table_container");
1275 if (NULL == if_ctx->container) {
1276 snmp_log(LOG_ERR, "error creating container in "
1277 "ipv4InterfaceTable_container_init\n");
1278 return;
1279 }
1280 if_ctx->container->container_name = strdup("ipv4InterfaceTable");
1281
1282 } /* _ipv4InterfaceTable_container_init */
1283
1284 /**
1285 * @internal
1286 * shutdown the container with functions or wrappers
1287 */
1288 void
1289 _ipv4InterfaceTable_container_shutdown(ipv4InterfaceTable_interface_ctx *
1290 if_ctx)
1291 {
1292 DEBUGMSGTL(("internal:ipv4InterfaceTable:_ipv4InterfaceTable_container_shutdown", "called\n"));
1293
1294 ipv4InterfaceTable_container_shutdown(if_ctx->container);
1295
1296 _container_free(if_ctx->container);
1297
1298 } /* _ipv4InterfaceTable_container_shutdown */
1299
1300
1301 ipv4InterfaceTable_rowreq_ctx *
1302 ipv4InterfaceTable_row_find_by_mib_index(ipv4InterfaceTable_mib_index *
1303 mib_idx)
1304 {
1305 ipv4InterfaceTable_rowreq_ctx *rowreq_ctx;
1306 oid oid_tmp[MAX_OID_LEN];
1307 netsnmp_index oid_idx;
1308 int rc;
1309
1310 /*
1311 * set up storage for OID
1312 */
1313 oid_idx.oids = oid_tmp;
1314 oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
1315
1316 /*
1317 * convert
1318 */
1319 rc = ifTable_index_to_oid(&oid_idx, mib_idx);
1320 if (MFD_SUCCESS != rc)
1321 return NULL;
1322
1323 rowreq_ctx =
1324 CONTAINER_FIND(ipv4InterfaceTable_if_ctx.container, &oid_idx);
1325
1326 return rowreq_ctx;
1327 }