Debian Codegraph @

agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_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 "tcpConnectionTable.h"
41
42
43 #include <net-snmp/agent/table_container.h>
44 #include <net-snmp/library/container.h>
45
46 #include "tcpConnectionTable_interface.h"
47
48 #include <ctype.h>
49
50 netsnmp_feature_child_of(tcpConnectionTable_external_access, libnetsnmpmibs);
51
52 netsnmp_feature_require(row_merge);
53 netsnmp_feature_require(baby_steps);
54 netsnmp_feature_require(check_all_requests_error);
55
56
57 netsnmp_feature_child_of(tcpConnectionTable_container_size, tcpConnectionTable_external_access);
58 netsnmp_feature_child_of(tcpConnectionTable_registration_set, tcpConnectionTable_external_access);
59 netsnmp_feature_child_of(tcpConnectionTable_registration_get, tcpConnectionTable_external_access);
60 netsnmp_feature_child_of(tcpConnectionTable_container_get, tcpConnectionTable_external_access);
61
62 /**********************************************************************
63 **********************************************************************
64 ***
65 *** Table tcpConnectionTable
66 ***
67 **********************************************************************
68 **********************************************************************/
69 /*
70 * TCP-MIB::tcpConnectionTable is subid 19 of tcp.
71 * Its status is Current.
72 * OID: .1.3.6.1.2.1.6.19, length: 8
73 */
74 typedef struct tcpConnectionTable_interface_ctx_s {
75
76 netsnmp_container *container;
77 netsnmp_cache *cache;
78
79 tcpConnectionTable_registration *user_ctx;
80
81 netsnmp_table_registration_info tbl_info;
82
83 netsnmp_baby_steps_access_methods access_multiplexer;
84
85 u_int table_dirty;
86
87 } tcpConnectionTable_interface_ctx;
88
89 static tcpConnectionTable_interface_ctx tcpConnectionTable_if_ctx;
90
91 static void
92 _tcpConnectionTable_container_init(tcpConnectionTable_interface_ctx *
93 if_ctx);
94 static void
95 _tcpConnectionTable_container_shutdown(tcpConnectionTable_interface_ctx *
96 if_ctx);
97
98 #ifndef NETSNMP_FEATURE_REMOVE_TCPCONNECTIONTABLE_CONTAINER_GET
99 netsnmp_container *
100 tcpConnectionTable_container_get(void)
101 {
102 return tcpConnectionTable_if_ctx.container;
103 }
104 #endif /* NETSNMP_FEATURE_REMOVE_TCPCONNECTIONTABLE_CONTAINER_GET */
105
106 #ifndef NETSNMP_FEATURE_REMOVE_TCPCONNECTIONTABLE_REGISTRATION_GET
107 tcpConnectionTable_registration *
108 tcpConnectionTable_registration_get(void)
109 {
110 return tcpConnectionTable_if_ctx.user_ctx;
111 }
112 #endif /* NETSNMP_FEATURE_REMOVE_TCPCONNECTIONTABLE_REGISTRATION_GET */
113
114 #ifndef NETSNMP_FEATURE_REMOVE_TCPCONNECTIONTABLE_REGISTRATION_SET
115 tcpConnectionTable_registration *
116 tcpConnectionTable_registration_set(tcpConnectionTable_registration *
117 newreg)
118 {
119 tcpConnectionTable_registration *old =
120 tcpConnectionTable_if_ctx.user_ctx;
121 tcpConnectionTable_if_ctx.user_ctx = newreg;
122 return old;
123 }
124 #endif /* NETSNMP_FEATURE_REMOVE_TCPCONNECTIONTABLE_REGISTRATION_SET */
125
126 #ifndef NETSNMP_FEATURE_REMOVE_TCPCONNECTIONTABLE_CONTAINER_SIZE
127 int
128 tcpConnectionTable_container_size(void)
129 {
130 return CONTAINER_SIZE(tcpConnectionTable_if_ctx.container);
131 }
132 #endif /* NETSNMP_FEATURE_REMOVE_TCPCONNECTIONTABLE_CONTAINER_SIZE */
133
134 u_int
135 tcpConnectionTable_dirty_get(void)
136 {
137 return tcpConnectionTable_if_ctx.table_dirty;
138 }
139
140 void
141 tcpConnectionTable_dirty_set(u_int status)
142 {
143 DEBUGMSGTL(("tcpConnectionTable:tcpConnectionTable_dirty_set",
144 "called. was %d, now %d\n",
145 tcpConnectionTable_if_ctx.table_dirty, status));
146 tcpConnectionTable_if_ctx.table_dirty = status;
147 }
148
149 /*
150 * mfd multiplexer modes
151 */
152 static Netsnmp_Node_Handler _mfd_tcpConnectionTable_pre_request;
153 static Netsnmp_Node_Handler _mfd_tcpConnectionTable_post_request;
154 static Netsnmp_Node_Handler _mfd_tcpConnectionTable_object_lookup;
155 static Netsnmp_Node_Handler _mfd_tcpConnectionTable_get_values;
156 #if !(defined(NETSNMP_NO_WRITE_SUPPORT) || defined(NETSNMP_DISABLE_SET_SUPPORT))
157 static Netsnmp_Node_Handler _mfd_tcpConnectionTable_check_objects;
158 static Netsnmp_Node_Handler _mfd_tcpConnectionTable_undo_setup;
159 static Netsnmp_Node_Handler _mfd_tcpConnectionTable_set_values;
160 static Netsnmp_Node_Handler _mfd_tcpConnectionTable_undo_cleanup;
161 static Netsnmp_Node_Handler _mfd_tcpConnectionTable_undo_values;
162 static Netsnmp_Node_Handler _mfd_tcpConnectionTable_commit;
163 static Netsnmp_Node_Handler _mfd_tcpConnectionTable_undo_commit;
164 static Netsnmp_Node_Handler _mfd_tcpConnectionTable_irreversible_commit;
165 static Netsnmp_Node_Handler _mfd_tcpConnectionTable_check_dependencies;
166
167 NETSNMP_STATIC_INLINE int
168 _tcpConnectionTable_undo_column(tcpConnectionTable_rowreq_ctx * rowreq_ctx,
169 netsnmp_variable_list *
170 var, int column);
171 #endif /* NETSNMP_NO_WRITE_SUPPORT || NETSNMP_DISABLE_SET_SUPPORT */
172
173 /**
174 * @internal
175 * Initialize the table tcpConnectionTable
176 * (Define its contents and how it's structured)
177 */
178 void
179 _tcpConnectionTable_initialize_interface(tcpConnectionTable_registration *
180 reg_ptr, u_long flags)
181 {
182 netsnmp_baby_steps_access_methods *access_multiplexer =
183 &tcpConnectionTable_if_ctx.access_multiplexer;
184 netsnmp_table_registration_info *tbl_info =
185 &tcpConnectionTable_if_ctx.tbl_info;
186 netsnmp_handler_registration *reginfo;
187 netsnmp_mib_handler *handler;
188 int mfd_modes = 0;
189
190 DEBUGMSGTL(("internal:tcpConnectionTable:_tcpConnectionTable_initialize_interface", "called\n"));
191
192
193 /*************************************************
194 *
195 * save interface context for tcpConnectionTable
196 */
197 /*
198 * Setting up the table's definition
199 */
200 netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,
201 /** index: tcpConnectionLocalAddressType */
202 ASN_OCTET_STR,
203 /** index: tcpConnectionLocalAddress */
204 ASN_UNSIGNED,
205 /** index: tcpConnectionLocalPort */
206 ASN_INTEGER,
207 /** index: tcpConnectionRemAddressType */
208 ASN_OCTET_STR,
209 /** index: tcpConnectionRemAddress */
210 ASN_UNSIGNED,
211 /** index: tcpConnectionRemPort */
212 0);
213
214 /*
215 * Define the minimum and maximum accessible columns. This
216 * optimizes retrieval.
217 */
218 tbl_info->min_column = TCPCONNECTIONTABLE_MIN_COL;
219 tbl_info->max_column = TCPCONNECTIONTABLE_MAX_COL;
220
221 /*
222 * save users context
223 */
224 tcpConnectionTable_if_ctx.user_ctx = reg_ptr;
225
226 /*
227 * call data access initialization code
228 */
229 tcpConnectionTable_init_data(reg_ptr);
230
231 /*
232 * set up the container
233 */
234 _tcpConnectionTable_container_init(&tcpConnectionTable_if_ctx);
235 if (NULL == tcpConnectionTable_if_ctx.container) {
236 snmp_log(LOG_ERR,
237 "could not initialize container for tcpConnectionTable\n");
238 return;
239 }
240
241 /*
242 * access_multiplexer: REQUIRED wrapper for get request handling
243 */
244 access_multiplexer->object_lookup =
245 _mfd_tcpConnectionTable_object_lookup;
246 access_multiplexer->get_values = _mfd_tcpConnectionTable_get_values;
247
248 /*
249 * no wrappers yet
250 */
251 access_multiplexer->pre_request = _mfd_tcpConnectionTable_pre_request;
252 access_multiplexer->post_request =
253 _mfd_tcpConnectionTable_post_request;
254
255 #if !(defined(NETSNMP_NO_WRITE_SUPPORT) || defined(NETSNMP_DISABLE_SET_SUPPORT))
256 /*
257 * REQUIRED wrappers for set request handling
258 */
259 access_multiplexer->object_syntax_checks =
260 _mfd_tcpConnectionTable_check_objects;
261 access_multiplexer->undo_setup = _mfd_tcpConnectionTable_undo_setup;
262 access_multiplexer->undo_cleanup =
263 _mfd_tcpConnectionTable_undo_cleanup;
264 access_multiplexer->set_values = _mfd_tcpConnectionTable_set_values;
265 access_multiplexer->undo_sets = _mfd_tcpConnectionTable_undo_values;
266
267 /*
268 * no wrappers yet
269 */
270 access_multiplexer->commit = _mfd_tcpConnectionTable_commit;
271 access_multiplexer->undo_commit = _mfd_tcpConnectionTable_undo_commit;
272 access_multiplexer->irreversible_commit =
273 _mfd_tcpConnectionTable_irreversible_commit;
274
275 /*
276 * REQUIRED for tables with dependencies
277 */
278 access_multiplexer->consistency_checks =
279 _mfd_tcpConnectionTable_check_dependencies;
280 #endif /* NETSNMP_NO_WRITE_SUPPORT || NETSNMP_DISABLE_SET_SUPPORT */
281
282 /*************************************************
283 *
284 * Create a registration, save our reg data, register table.
285 */
286 DEBUGMSGTL(("tcpConnectionTable:init_tcpConnectionTable",
287 "Registering tcpConnectionTable as a mibs-for-dummies table.\n"));
288 handler =
289 netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
290 reginfo =
291 netsnmp_handler_registration_create("tcpConnectionTable", handler,
292 tcpConnectionTable_oid,
293 tcpConnectionTable_oid_size,
294 HANDLER_CAN_BABY_STEP |
295 #if !(defined(NETSNMP_NO_WRITE_SUPPORT) || defined(NETSNMP_DISABLE_SET_SUPPORT))
296 HANDLER_CAN_RWRITE
297 #else
298 HANDLER_CAN_RONLY
299 #endif /* NETSNMP_NO_WRITE_SUPPORT || NETSNMP_DISABLE_SET_SUPPORT */
300 );
301 if (NULL == reginfo) {
302 snmp_log(LOG_ERR, "error registering table tcpConnectionTable\n");
303 return;
304 }
305 reginfo->my_reg_void = &tcpConnectionTable_if_ctx;
306
307 /*************************************************
308 *
309 * set up baby steps handler, create it and inject it
310 */
311 if (access_multiplexer->object_lookup)
312 mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
313 if (access_multiplexer->pre_request)
314 mfd_modes |= BABY_STEP_PRE_REQUEST;
315 if (access_multiplexer->post_request)
316 mfd_modes |= BABY_STEP_POST_REQUEST;
317
318 #if !(defined(NETSNMP_NO_WRITE_SUPPORT) || defined(NETSNMP_DISABLE_SET_SUPPORT))
319 if (access_multiplexer->set_values)
320 mfd_modes |= BABY_STEP_SET_VALUES;
321 if (access_multiplexer->irreversible_commit)
322 mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
323 if (access_multiplexer->object_syntax_checks)
324 mfd_modes |= BABY_STEP_CHECK_OBJECT;
325
326 if (access_multiplexer->undo_setup)
327 mfd_modes |= BABY_STEP_UNDO_SETUP;
328 if (access_multiplexer->undo_cleanup)
329 mfd_modes |= BABY_STEP_UNDO_CLEANUP;
330 if (access_multiplexer->undo_sets)
331 mfd_modes |= BABY_STEP_UNDO_SETS;
332
333 if (access_multiplexer->row_creation)
334 mfd_modes |= BABY_STEP_ROW_CREATE;
335 if (access_multiplexer->consistency_checks)
336 mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
337 if (access_multiplexer->commit)
338 mfd_modes |= BABY_STEP_COMMIT;
339 if (access_multiplexer->undo_commit)
340 mfd_modes |= BABY_STEP_UNDO_COMMIT;
341 #endif /* NETSNMP_NO_WRITE_SUPPORT || NETSNMP_DISABLE_SET_SUPPORT */
342
343 handler = netsnmp_baby_steps_handler_get(mfd_modes);
344 netsnmp_inject_handler(reginfo, handler);
345
346 /*************************************************
347 *
348 * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
349 */
350 handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
351 netsnmp_inject_handler(reginfo, handler);
352
353 /*************************************************
354 *
355 * inject container_table helper
356 */
357 handler =
358 netsnmp_container_table_handler_get(tbl_info,
359 tcpConnectionTable_if_ctx.
360 container,
361 TABLE_CONTAINER_KEY_NETSNMP_INDEX);
362 netsnmp_inject_handler(reginfo, handler);
363
364 /*************************************************
365 *
366 * inject cache helper
367 */
368 if (NULL != tcpConnectionTable_if_ctx.cache) {
369 handler =
370 netsnmp_cache_handler_get(tcpConnectionTable_if_ctx.cache);
371 netsnmp_inject_handler(reginfo, handler);
372 }
373
374 /*
375 * register table
376 */
377 netsnmp_register_table(reginfo, tbl_info);
378
379 } /* _tcpConnectionTable_initialize_interface */
380
381 /**
382 * @internal
383 * Shutdown the table tcpConnectionTable
384 */
385 void
386 _tcpConnectionTable_shutdown_interface(tcpConnectionTable_registration *
387 reg_ptr)
388 {
389 /*
390 * shutdown the container
391 */
392 _tcpConnectionTable_container_shutdown(&tcpConnectionTable_if_ctx);
393 }
394
395 void
396 tcpConnectionTable_valid_columns_set(netsnmp_column_info *vc)
397 {
398 tcpConnectionTable_if_ctx.tbl_info.valid_columns = vc;
399 } /* tcpConnectionTable_valid_columns_set */
400
401 /**
402 * @internal
403 * convert the index component stored in the context to an oid
404 */
405 int
406 tcpConnectionTable_index_to_oid(netsnmp_index * oid_idx,
407 tcpConnectionTable_mib_index * mib_idx)
408 {
409 int err = SNMP_ERR_NOERROR;
410
411 /*
412 * temp storage for parsing indexes
413 */
414 /*
415 * tcpConnectionLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
416 */
417 netsnmp_variable_list var_tcpConnectionLocalAddressType;
418 /*
419 * tcpConnectionLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
420 */
421 netsnmp_variable_list var_tcpConnectionLocalAddress;
422 /*
423 * tcpConnectionLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
424 */
425 netsnmp_variable_list var_tcpConnectionLocalPort;
426 /*
427 * tcpConnectionRemAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
428 */
429 netsnmp_variable_list var_tcpConnectionRemAddressType;
430 /*
431 * tcpConnectionRemAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
432 */
433 netsnmp_variable_list var_tcpConnectionRemAddress;
434 /*
435 * tcpConnectionRemPort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
436 */
437 netsnmp_variable_list var_tcpConnectionRemPort;
438
439 /*
440 * set up varbinds
441 */
442 memset(&var_tcpConnectionLocalAddressType, 0x00,
443 sizeof(var_tcpConnectionLocalAddressType));
444 var_tcpConnectionLocalAddressType.type = ASN_INTEGER;
445 memset(&var_tcpConnectionLocalAddress, 0x00,
446 sizeof(var_tcpConnectionLocalAddress));
447 var_tcpConnectionLocalAddress.type = ASN_OCTET_STR;
448 memset(&var_tcpConnectionLocalPort, 0x00,
449 sizeof(var_tcpConnectionLocalPort));
450 var_tcpConnectionLocalPort.type = ASN_UNSIGNED;
451 memset(&var_tcpConnectionRemAddressType, 0x00,
452 sizeof(var_tcpConnectionRemAddressType));
453 var_tcpConnectionRemAddressType.type = ASN_INTEGER;
454 memset(&var_tcpConnectionRemAddress, 0x00,
455 sizeof(var_tcpConnectionRemAddress));
456 var_tcpConnectionRemAddress.type = ASN_OCTET_STR;
457 memset(&var_tcpConnectionRemPort, 0x00,
458 sizeof(var_tcpConnectionRemPort));
459 var_tcpConnectionRemPort.type = ASN_UNSIGNED;
460
461 /*
462 * chain temp index varbinds together
463 */
464 var_tcpConnectionLocalAddressType.next_variable =
465 &var_tcpConnectionLocalAddress;
466 var_tcpConnectionLocalAddress.next_variable =
467 &var_tcpConnectionLocalPort;
468 var_tcpConnectionLocalPort.next_variable =
469 &var_tcpConnectionRemAddressType;
470 var_tcpConnectionRemAddressType.next_variable =
471 &var_tcpConnectionRemAddress;
472 var_tcpConnectionRemAddress.next_variable = &var_tcpConnectionRemPort;
473 var_tcpConnectionRemPort.next_variable = NULL;
474
475
476 DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_index_to_oid", "called\n"));
477
478 /*
479 * tcpConnectionLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
480 */
481 snmp_set_var_value(&var_tcpConnectionLocalAddressType,
482 (u_char *) & mib_idx->tcpConnectionLocalAddressType,
483 sizeof(mib_idx->tcpConnectionLocalAddressType));
484
485 /*
486 * tcpConnectionLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
487 */
488 snmp_set_var_value(&var_tcpConnectionLocalAddress,
489 (u_char *) & mib_idx->tcpConnectionLocalAddress,
490 mib_idx->tcpConnectionLocalAddress_len *
491 sizeof(mib_idx->tcpConnectionLocalAddress[0]));
492
493 /*
494 * tcpConnectionLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
495 */
496 snmp_set_var_value(&var_tcpConnectionLocalPort,
497 (u_char *) & mib_idx->tcpConnectionLocalPort,
498 sizeof(mib_idx->tcpConnectionLocalPort));
499
500 /*
501 * tcpConnectionRemAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
502 */
503 snmp_set_var_value(&var_tcpConnectionRemAddressType,
504 (u_char *) & mib_idx->tcpConnectionRemAddressType,
505 sizeof(mib_idx->tcpConnectionRemAddressType));
506
507 /*
508 * tcpConnectionRemAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
509 */
510 snmp_set_var_value(&var_tcpConnectionRemAddress,
511 (u_char *) & mib_idx->tcpConnectionRemAddress,
512 mib_idx->tcpConnectionRemAddress_len *
513 sizeof(mib_idx->tcpConnectionRemAddress[0]));
514
515 /*
516 * tcpConnectionRemPort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
517 */
518 snmp_set_var_value(&var_tcpConnectionRemPort,
519 (u_char *) & mib_idx->tcpConnectionRemPort,
520 sizeof(mib_idx->tcpConnectionRemPort));
521
522
523 err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
524 NULL, 0, &var_tcpConnectionLocalAddressType);
525 if (err)
526 snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
527
528 /*
529 * parsing may have allocated memory. free it.
530 */
531 snmp_reset_var_buffers(&var_tcpConnectionLocalAddressType);
532
533 return err;
534 } /* tcpConnectionTable_index_to_oid */
535
536 /**
537 * extract tcpConnectionTable indexes from a netsnmp_index
538 *
539 * @retval SNMP_ERR_NOERROR : no error
540 * @retval SNMP_ERR_GENERR : error
541 */
542 int
543 tcpConnectionTable_index_from_oid(netsnmp_index * oid_idx,
544 tcpConnectionTable_mib_index * mib_idx)
545 {
546 int err = SNMP_ERR_NOERROR;
547
548 /*
549 * temp storage for parsing indexes
550 */
551 /*
552 * tcpConnectionLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
553 */
554 netsnmp_variable_list var_tcpConnectionLocalAddressType;
555 /*
556 * tcpConnectionLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
557 */
558 netsnmp_variable_list var_tcpConnectionLocalAddress;
559 /*
560 * tcpConnectionLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
561 */
562 netsnmp_variable_list var_tcpConnectionLocalPort;
563 /*
564 * tcpConnectionRemAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
565 */
566 netsnmp_variable_list var_tcpConnectionRemAddressType;
567 /*
568 * tcpConnectionRemAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
569 */
570 netsnmp_variable_list var_tcpConnectionRemAddress;
571 /*
572 * tcpConnectionRemPort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
573 */
574 netsnmp_variable_list var_tcpConnectionRemPort;
575
576 /*
577 * set up varbinds
578 */
579 memset(&var_tcpConnectionLocalAddressType, 0x00,
580 sizeof(var_tcpConnectionLocalAddressType));
581 var_tcpConnectionLocalAddressType.type = ASN_INTEGER;
582 memset(&var_tcpConnectionLocalAddress, 0x00,
583 sizeof(var_tcpConnectionLocalAddress));
584 var_tcpConnectionLocalAddress.type = ASN_OCTET_STR;
585 memset(&var_tcpConnectionLocalPort, 0x00,
586 sizeof(var_tcpConnectionLocalPort));
587 var_tcpConnectionLocalPort.type = ASN_UNSIGNED;
588 memset(&var_tcpConnectionRemAddressType, 0x00,
589 sizeof(var_tcpConnectionRemAddressType));
590 var_tcpConnectionRemAddressType.type = ASN_INTEGER;
591 memset(&var_tcpConnectionRemAddress, 0x00,
592 sizeof(var_tcpConnectionRemAddress));
593 var_tcpConnectionRemAddress.type = ASN_OCTET_STR;
594 memset(&var_tcpConnectionRemPort, 0x00,
595 sizeof(var_tcpConnectionRemPort));
596 var_tcpConnectionRemPort.type = ASN_UNSIGNED;
597
598 /*
599 * chain temp index varbinds together
600 */
601 var_tcpConnectionLocalAddressType.next_variable =
602 &var_tcpConnectionLocalAddress;
603 var_tcpConnectionLocalAddress.next_variable =
604 &var_tcpConnectionLocalPort;
605 var_tcpConnectionLocalPort.next_variable =
606 &var_tcpConnectionRemAddressType;
607 var_tcpConnectionRemAddressType.next_variable =
608 &var_tcpConnectionRemAddress;
609 var_tcpConnectionRemAddress.next_variable = &var_tcpConnectionRemPort;
610 var_tcpConnectionRemPort.next_variable = NULL;
611
612
613 DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_index_from_oid", "called\n"));
614
615 /*
616 * parse the oid into the individual index components
617 */
618 err = parse_oid_indexes(oid_idx->oids, oid_idx->len,
619 &var_tcpConnectionLocalAddressType);
620 if (err == SNMP_ERR_NOERROR) {
621 /*
622 * copy out values
623 */
624 mib_idx->tcpConnectionLocalAddressType =
625 *((u_long *) var_tcpConnectionLocalAddressType.val.string);
626 /*
627 * NOTE: val_len is in bytes, tcpConnectionLocalAddress_len might not be
628 */
629 if (var_tcpConnectionLocalAddress.val_len >
630 sizeof(mib_idx->tcpConnectionLocalAddress))
631 err = SNMP_ERR_GENERR;
632 else {
633 memcpy(mib_idx->tcpConnectionLocalAddress,
634 var_tcpConnectionLocalAddress.val.string,
635 var_tcpConnectionLocalAddress.val_len);
636 mib_idx->tcpConnectionLocalAddress_len =
637 var_tcpConnectionLocalAddress.val_len /
638 sizeof(mib_idx->tcpConnectionLocalAddress[0]);
639 }
640 mib_idx->tcpConnectionLocalPort =
641 *((u_long *) var_tcpConnectionLocalPort.val.string);
642 mib_idx->tcpConnectionRemAddressType =
643 *((u_long *) var_tcpConnectionRemAddressType.val.string);
644 /*
645 * NOTE: val_len is in bytes, tcpConnectionRemAddress_len might not be
646 */
647 if (var_tcpConnectionRemAddress.val_len >
648 sizeof(mib_idx->tcpConnectionRemAddress))
649 err = SNMP_ERR_GENERR;
650 else {
651 memcpy(mib_idx->tcpConnectionRemAddress,
652 var_tcpConnectionRemAddress.val.string,
653 var_tcpConnectionRemAddress.val_len);
654 mib_idx->tcpConnectionRemAddress_len =
655 var_tcpConnectionRemAddress.val_len /
656 sizeof(mib_idx->tcpConnectionRemAddress[0]);
657 }
658 mib_idx->tcpConnectionRemPort =
659 *((u_long *) var_tcpConnectionRemPort.val.string);
660
661
662 }
663
664 /*
665 * parsing may have allocated memory. free it.
666 */
667 snmp_reset_var_buffers(&var_tcpConnectionLocalAddressType);
668
669 return err;
670 } /* tcpConnectionTable_index_from_oid */
671
672
673 /*
674 *********************************************************************
675 * @internal
676 * allocate resources for a tcpConnectionTable_rowreq_ctx
677 */
678 tcpConnectionTable_rowreq_ctx *
679 tcpConnectionTable_allocate_rowreq_ctx(tcpConnectionTable_data * data,
680 void *user_init_ctx)
681 {
682 tcpConnectionTable_rowreq_ctx *rowreq_ctx =
683 SNMP_MALLOC_TYPEDEF(tcpConnectionTable_rowreq_ctx);
684
685 DEBUGMSGTL(("internal:tcpConnectionTable:tcpConnectionTable_allocate_rowreq_ctx", "called\n"));
686
687 if (NULL == rowreq_ctx) {
688 snmp_log(LOG_ERR, "Couldn't allocate memory for a "
689 "tcpConnectionTable_rowreq_ctx.\n");
690 return NULL;
691 } else {
692 if (NULL != data) {
693 /*
694 * track if we got data from user
695 */
696 rowreq_ctx->rowreq_flags |= MFD_ROW_DATA_FROM_USER;
697 rowreq_ctx->data = data;
698 } else if (NULL ==
699 (rowreq_ctx->data =
700 tcpConnectionTable_allocate_data())) {
701 SNMP_FREE(rowreq_ctx);
702 return NULL;
703 }
704 }
705
706 /*
707 * undo context will be allocated when needed (in *_undo_setup)
708 */
709
710 rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
711
712 rowreq_ctx->tcpConnectionTable_data_list = NULL;
713
714 /*
715 * if we allocated data, call init routine
716 */
717 if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) {
718 if (SNMPERR_SUCCESS !=
719 tcpConnectionTable_rowreq_ctx_init(rowreq_ctx,
720 user_init_ctx)) {
721 tcpConnectionTable_release_rowreq_ctx(rowreq_ctx);
722 rowreq_ctx = NULL;
723 }
724 }
725
726 return rowreq_ctx;
727 } /* tcpConnectionTable_allocate_rowreq_ctx */
728
729 /*
730 * @internal
731 * release resources for a tcpConnectionTable_rowreq_ctx
732 */
733 void
734 tcpConnectionTable_release_rowreq_ctx(tcpConnectionTable_rowreq_ctx *
735 rowreq_ctx)
736 {
737 DEBUGMSGTL(("internal:tcpConnectionTable:tcpConnectionTable_release_rowreq_ctx", "called\n"));
738
739 netsnmp_assert(NULL != rowreq_ctx);
740
741 tcpConnectionTable_rowreq_ctx_cleanup(rowreq_ctx);
742
743 /*
744 * for non-transient data, don't free data we got from the user
745 */
746 if ((rowreq_ctx->data) &&
747 !(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER))
748 tcpConnectionTable_release_data(rowreq_ctx->data);
749
750 if (rowreq_ctx->undo)
751 tcpConnectionTable_release_data(rowreq_ctx->undo);
752
753 /*
754 * free index oid pointer
755 */
756 if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp)
757 free(rowreq_ctx->oid_idx.oids);
758
759 SNMP_FREE(rowreq_ctx);
760 } /* tcpConnectionTable_release_rowreq_ctx */
761
762 /**
763 * @internal
764 * wrapper
765 */
766 static int
767 _mfd_tcpConnectionTable_pre_request(netsnmp_mib_handler *handler,
768 netsnmp_handler_registration *reginfo,
769 netsnmp_agent_request_info
770 *agtreq_info,
771 netsnmp_request_info *requests)
772 {
773 int rc;
774
775 DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_pre_request", "called\n"));
776
777 if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
778 DEBUGMSGTL(("internal:tcpConnectionTable",
779 "skipping additional pre_request\n"));
780 return SNMP_ERR_NOERROR;
781 }
782
783 rc = tcpConnectionTable_pre_request(tcpConnectionTable_if_ctx.
784 user_ctx);
785 if (MFD_SUCCESS != rc) {
786 /*
787 * nothing we can do about it but log it
788 */
789 DEBUGMSGTL(("tcpConnectionTable", "error %d from "
790 "tcpConnectionTable_pre_request\n", rc));
791 netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
792 }
793
794 return SNMP_ERR_NOERROR;
795 } /* _mfd_tcpConnectionTable_pre_request */
796
797 /**
798 * @internal
799 * wrapper
800 */
801 static int
802 _mfd_tcpConnectionTable_post_request(netsnmp_mib_handler *handler,
803 netsnmp_handler_registration *reginfo,
804 netsnmp_agent_request_info
805 *agtreq_info,
806 netsnmp_request_info *requests)
807 {
808 tcpConnectionTable_rowreq_ctx *rowreq_ctx = (tcpConnectionTable_rowreq_ctx*)
809 netsnmp_container_table_row_extract(requests);
810 int rc, packet_rc;
811
812 DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_post_request", "called\n"));
813
814 /*
815 * release row context, if deleted
816 */
817 if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))
818 tcpConnectionTable_release_rowreq_ctx(rowreq_ctx);
819
820 /*
821 * wait for last call before calling user
822 */
823 if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
824 DEBUGMSGTL(("internal:tcpConnectionTable",
825 "waiting for last post_request\n"));
826 return SNMP_ERR_NOERROR;
827 }
828
829 packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
830 if ((MFD_SUCCESS != packet_rc) && tcpConnectionTable_dirty_get()) {
831 /*
832 * we shouldn't get here. the undo steps should also clear
833 * the dirty flags.
834 */
835 snmp_log(LOG_WARNING,
836 "tcpConnectionTable dirty flag set in post_request "
837 "but status != SUCCESS.\n");
838 }
839
840 rc = tcpConnectionTable_post_request(tcpConnectionTable_if_ctx.
841 user_ctx, packet_rc);
842 if (MFD_SUCCESS != rc) {
843 /*
844 * nothing we can do about it but log it
845 */
846 DEBUGMSGTL(("tcpConnectionTable", "error %d from "
847 "tcpConnectionTable_post_request\n", rc));
848 }
849
850 return SNMP_ERR_NOERROR;
851 } /* _mfd_tcpConnectionTable_post_request */
852
853 /**
854 * @internal
855 * wrapper
856 */
857 static int
858 _mfd_tcpConnectionTable_object_lookup(netsnmp_mib_handler *handler, netsnmp_handler_registration
859 *reginfo, netsnmp_agent_request_info
860 *agtreq_info,
861 netsnmp_request_info *requests)
862 {
863 int rc = SNMP_ERR_NOERROR;
864 tcpConnectionTable_rowreq_ctx *rowreq_ctx = (tcpConnectionTable_rowreq_ctx*)
865 netsnmp_container_table_row_extract(requests);
866
867 DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_object_lookup", "called\n"));
868
869 /*
870 * get our context from mfd
871 * tcpConnectionTable_interface_ctx *if_ctx =
872 * (tcpConnectionTable_interface_ctx *)reginfo->my_reg_void;
873 */
874
875 if (NULL == rowreq_ctx) {
876 rc = SNMP_ERR_NOCREATION;
877 }
878
879 if (MFD_SUCCESS != rc)
880 netsnmp_request_set_error_all(requests, rc);
881 else
882 tcpConnectionTable_row_prep(rowreq_ctx);
883
884 return SNMP_VALIDATE_ERR(rc);
885 } /* _mfd_tcpConnectionTable_object_lookup */
886
887 /***********************************************************************
888 *
889 * GET processing
890 *
891 ***********************************************************************/
892 /*
893 * @internal
894 * Retrieve the value for a particular column
895 */
896 NETSNMP_STATIC_INLINE int
897 _tcpConnectionTable_get_column(tcpConnectionTable_rowreq_ctx * rowreq_ctx,
898 netsnmp_variable_list * var, int column)
899 {
900 int rc = SNMPERR_SUCCESS;
901
902 DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_get_column", "called for %d\n", column));
903
904
905 netsnmp_assert(NULL != rowreq_ctx);
906
907 switch (column) {
908
909 /*
910 * tcpConnectionState(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
911 */
912 case COLUMN_TCPCONNECTIONSTATE:
913 var->val_len = sizeof(u_long);
914 var->type = ASN_INTEGER;
915 rc = tcpConnectionState_get(rowreq_ctx,
916 (u_long *) var->val.string);
917 break;
918
919 /*
920 * tcpConnectionProcess(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
921 */
922 case COLUMN_TCPCONNECTIONPROCESS:
923 var->val_len = sizeof(u_long);
924 var->type = ASN_UNSIGNED;
925 rc = tcpConnectionProcess_get(rowreq_ctx,
926 (u_long *) var->val.string);
927 break;
928
929 default:
930 snmp_log(LOG_ERR,
931 "unknown column %d in _tcpConnectionTable_get_column\n",
932 column);
933 break;
934 }
935
936 return rc;
937 } /* _tcpConnectionTable_get_column */
938
939 int
940 _mfd_tcpConnectionTable_get_values(netsnmp_mib_handler *handler,
941 netsnmp_handler_registration *reginfo,
942 netsnmp_agent_request_info *agtreq_info,
943 netsnmp_request_info *requests)
944 {
945 tcpConnectionTable_rowreq_ctx *rowreq_ctx = (tcpConnectionTable_rowreq_ctx*)
946 netsnmp_container_table_row_extract(requests);
947 netsnmp_table_request_info *tri;
948 u_char *old_string;
949 void (*dataFreeHook) (void *);
950 int rc;
951
952 DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_get_values", "called\n"));
953
954 netsnmp_assert(NULL != rowreq_ctx);
955
956 for (; requests; requests = requests->next) {
957 /*
958 * save old pointer, so we can free it if replaced
959 */
960 old_string = requests->requestvb->val.string;
961 dataFreeHook = requests->requestvb->dataFreeHook;
962 if (NULL == requests->requestvb->val.string) {
963 requests->requestvb->val.string = requests->requestvb->buf;
964 requests->requestvb->val_len =
965 sizeof(requests->requestvb->buf);
966 } else if (requests->requestvb->buf ==
967 requests->requestvb->val.string) {
968 if (requests->requestvb->val_len !=
969 sizeof(requests->requestvb->buf))
970 requests->requestvb->val_len =
971 sizeof(requests->requestvb->buf);
972 }
973
974 /*
975 * get column data
976 */
977 tri = netsnmp_extract_table_info(requests);
978 if (NULL == tri)
979 continue;
980
981 rc = _tcpConnectionTable_get_column(rowreq_ctx,
982 requests->requestvb,
983 tri->colnum);
984 if (rc) {
985 if (MFD_SKIP == rc) {
986 requests->requestvb->type = SNMP_NOSUCHINSTANCE;
987 rc = SNMP_ERR_NOERROR;
988 }
989 } else if (NULL == requests->requestvb->val.string) {
990 snmp_log(LOG_ERR, "NULL varbind data pointer!\n");
991 rc = SNMP_ERR_GENERR;
992 }
993 if (rc)
994 netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
995
996 /*
997 * if the buffer wasn't used previously for the old data (i.e. it
998 * was allocated memory) and the get routine replaced the pointer,
999 * we need to free the previous pointer.
1000 */
1001 if (old_string && (old_string != requests->requestvb->buf) &&
1002 (requests->requestvb->val.string != old_string)) {
1003 if (dataFreeHook)
1004 (*dataFreeHook) (old_string);
1005 else
1006 free(old_string);
1007 }
1008 } /* for results */
1009
1010 return SNMP_ERR_NOERROR;
1011 } /* _mfd_tcpConnectionTable_get_values */
1012
1013
1014 #if !(defined(NETSNMP_NO_WRITE_SUPPORT) || defined(NETSNMP_DISABLE_SET_SUPPORT))
1015 /***********************************************************************
1016 *
1017 * SET processing
1018 *
1019 ***********************************************************************/
1020
1021 /*----------------------------------------------------------------------
1022 *
1023 * SET: Syntax checks
1024 *
1025 *---------------------------------------------------------------------*/
1026 /*
1027 * @internal
1028 * Check the syntax for a particular column
1029 */
1030 NETSNMP_STATIC_INLINE int
1031 _tcpConnectionTable_check_column(tcpConnectionTable_rowreq_ctx *
1032 rowreq_ctx, netsnmp_variable_list * var,
1033 int column)
1034 {
1035 int rc = SNMPERR_SUCCESS;
1036
1037 DEBUGMSGTL(("internal:tcpConnectionTable:_tcpConnectionTable_check_column", "called for %d\n", column));
1038
1039 netsnmp_assert(NULL != rowreq_ctx);
1040
1041 switch (column) {
1042 /*
1043 * (INDEX) tcpConnectionLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
1044 */
1045 case COLUMN_TCPCONNECTIONLOCALADDRESSTYPE:
1046 rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
1047 break;
1048 /*
1049 * (INDEX) tcpConnectionLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
1050 */
1051 case COLUMN_TCPCONNECTIONLOCALADDRESS:
1052 rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
1053 break;
1054 /*
1055 * (INDEX) tcpConnectionLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
1056 */
1057 case COLUMN_TCPCONNECTIONLOCALPORT:
1058 rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
1059 break;
1060 /*
1061 * (INDEX) tcpConnectionRemAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
1062 */
1063 case COLUMN_TCPCONNECTIONREMADDRESSTYPE:
1064 rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
1065 break;
1066 /*
1067 * (INDEX) tcpConnectionRemAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
1068 */
1069 case COLUMN_TCPCONNECTIONREMADDRESS:
1070 rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
1071 break;
1072 /*
1073 * (INDEX) tcpConnectionRemPort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
1074 */
1075 case COLUMN_TCPCONNECTIONREMPORT:
1076 rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
1077 break;
1078
1079 /*
1080 * tcpConnectionState(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
1081 */
1082 case COLUMN_TCPCONNECTIONSTATE:
1083 rc = netsnmp_check_vb_type(var, ASN_INTEGER);
1084 /*
1085 * check that the value is one of defined enums
1086 */
1087 if ((SNMPERR_SUCCESS == rc)
1088 && (*var->val.integer != TCPCONNECTIONSTATE_CLOSED)
1089 && (*var->val.integer != TCPCONNECTIONSTATE_LISTEN)
1090 && (*var->val.integer != TCPCONNECTIONSTATE_SYNSENT)
1091 && (*var->val.integer != TCPCONNECTIONSTATE_SYNRECEIVED)
1092 && (*var->val.integer != TCPCONNECTIONSTATE_ESTABLISHED)
1093 && (*var->val.integer != TCPCONNECTIONSTATE_FINWAIT1)
1094 && (*var->val.integer != TCPCONNECTIONSTATE_FINWAIT2)
1095 && (*var->val.integer != TCPCONNECTIONSTATE_CLOSEWAIT)
1096 && (*var->val.integer != TCPCONNECTIONSTATE_LASTACK)
1097 && (*var->val.integer != TCPCONNECTIONSTATE_CLOSING)
1098 && (*var->val.integer != TCPCONNECTIONSTATE_TIMEWAIT)
1099 && (*var->val.integer != TCPCONNECTIONSTATE_DELETETCB)
1100 ) {
1101 rc = SNMP_ERR_WRONGVALUE;
1102 }
1103 if (SNMPERR_SUCCESS != rc) {
1104 DEBUGMSGTL(("tcpConnectionTable:_tcpConnectionTable_check_column:tcpConnectionState", "varbind validation failed (eg bad type or size)\n"));
1105 } else {
1106 rc = tcpConnectionState_check_value(rowreq_ctx,
1107 *((u_long *) var->val.
1108 string));
1109 if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
1110 && (MFD_NOT_VALID_NOW != rc)) {
1111 snmp_log(LOG_ERR,
1112 "bad rc %d from tcpConnectionState_check_value\n",
1113 rc);
1114 rc = SNMP_ERR_GENERR;
1115 }
1116 }
1117 break;
1118
1119 /*
1120 * tcpConnectionProcess(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
1121 */
1122 case COLUMN_TCPCONNECTIONPROCESS:
1123 rc = SNMP_ERR_NOTWRITABLE;
1124 break;
1125
1126 default: /** We shouldn't get here */
1127 rc = SNMP_ERR_GENERR;
1128 snmp_log(LOG_ERR,
1129 "unknown column %d in _tcpConnectionTable_check_column\n",
1130 column);
1131 }
1132
1133 return rc;
1134 } /* _tcpConnectionTable_check_column */
1135
1136 int
1137 _mfd_tcpConnectionTable_check_objects(netsnmp_mib_handler *handler, netsnmp_handler_registration
1138 *reginfo, netsnmp_agent_request_info
1139 *agtreq_info,
1140 netsnmp_request_info *requests)
1141 {
1142 tcpConnectionTable_rowreq_ctx *rowreq_ctx = (tcpConnectionTable_rowreq_ctx*)
1143 netsnmp_container_table_row_extract(requests);
1144 netsnmp_table_request_info *tri;
1145 int rc;
1146
1147 DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_check_objects", "called\n"));
1148
1149 netsnmp_assert(NULL != rowreq_ctx);
1150
1151 for (; requests; requests = requests->next) {
1152
1153 /*
1154 * get column number from table request info, and check that column
1155 */
1156 tri = netsnmp_extract_table_info(requests);
1157 if (NULL == tri)
1158 continue;
1159
1160 rc = _tcpConnectionTable_check_column(rowreq_ctx,
1161 requests->requestvb,
1162 tri->colnum);
1163 if (rc) {
1164 netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
1165 break;
1166 }
1167
1168 } /* for results */
1169
1170 return SNMP_ERR_NOERROR;
1171 } /* _mfd_tcpConnectionTable_check_objects */
1172
1173
1174 /*----------------------------------------------------------------------
1175 *
1176 * SET: check dependencies
1177 *
1178 *---------------------------------------------------------------------*/
1179 /*
1180 * @internal
1181 * Check dependencies wrapper
1182 */
1183 static int
1184 _mfd_tcpConnectionTable_check_dependencies(netsnmp_mib_handler *handler, netsnmp_handler_registration
1185 *reginfo, netsnmp_agent_request_info
1186 *agtreq_info,
1187 netsnmp_request_info *requests)
1188 {
1189 int rc;
1190 tcpConnectionTable_rowreq_ctx *rowreq_ctx = (tcpConnectionTable_rowreq_ctx*)
1191 netsnmp_container_table_row_extract(requests);
1192 DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_check_dependencies", "called\n"));
1193
1194 netsnmp_assert(NULL != rowreq_ctx);
1195
1196 rc = tcpConnectionTable_check_dependencies(rowreq_ctx);
1197 if (rc) {
1198 DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
1199 "tcpConnectionTable_check_dependencies\n", rc));
1200 netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
1201 }
1202
1203 return SNMP_ERR_NOERROR;
1204 } /* _mfd_tcpConnectionTable_check_dependencies */
1205
1206 /*----------------------------------------------------------------------
1207 *
1208 * SET: Undo setup
1209 *
1210 *---------------------------------------------------------------------*/
1211 /*
1212 * @internal
1213 * Set the value for a particular column
1214 */
1215 NETSNMP_STATIC_INLINE int
1216 _tcpConnectionTable_undo_setup_column(tcpConnectionTable_rowreq_ctx *
1217 rowreq_ctx, int column)
1218 {
1219 int rc = SNMPERR_SUCCESS;
1220
1221 DEBUGMSGTL(("internal:tcpConnectionTable:_tcpConnectionTable_undo_setup_column", "called for %d\n", column));
1222
1223 netsnmp_assert(NULL != rowreq_ctx);
1224
1225 switch (column) {
1226
1227 /*
1228 * tcpConnectionState(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
1229 */
1230 case COLUMN_TCPCONNECTIONSTATE:
1231 rowreq_ctx->column_set_flags |= COLUMN_TCPCONNECTIONSTATE_FLAG;
1232 rc = tcpConnectionState_undo_setup(rowreq_ctx);
1233 break;
1234
1235 default:
1236 snmp_log(LOG_ERR,
1237 "unknown column %d in _tcpConnectionTable_undo_setup_column\n",
1238 column);
1239 break;
1240 }
1241
1242 return rc;
1243 } /* _tcpConnectionTable_undo_setup_column */
1244
1245
1246 /**
1247 * @internal
1248 * undo setup
1249 */
1250 int
1251 _mfd_tcpConnectionTable_undo_setup(netsnmp_mib_handler *handler,
1252 netsnmp_handler_registration *reginfo,
1253 netsnmp_agent_request_info *agtreq_info,
1254 netsnmp_request_info *requests)
1255 {
1256 int rc;
1257 tcpConnectionTable_rowreq_ctx *rowreq_ctx = (tcpConnectionTable_rowreq_ctx*)
1258 netsnmp_container_table_row_extract(requests);
1259
1260 DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_undo_setup", "called\n"));
1261
1262 netsnmp_assert(NULL != rowreq_ctx);
1263
1264 /*
1265 * allocate undo context
1266 */
1267 rowreq_ctx->undo = tcpConnectionTable_allocate_data();
1268 if (NULL == rowreq_ctx->undo) {
1269 /** msg already logged */
1270 netsnmp_request_set_error_all(requests,
1271 SNMP_ERR_RESOURCEUNAVAILABLE);
1272 return SNMP_ERR_NOERROR;
1273 }
1274
1275 /*
1276 * row undo setup
1277 */
1278 rowreq_ctx->column_set_flags = 0;
1279 rc = tcpConnectionTable_undo_setup(rowreq_ctx);
1280 if (MFD_SUCCESS != rc) {
1281 DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
1282 "tcpConnectionTable_undo_setup\n", rc));
1283 netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
1284 } else {
1285 /*
1286 * column undo setup
1287 */
1288 netsnmp_table_request_info *tri;
1289 for (; requests; requests = requests->next) {
1290 /*
1291 * set column data
1292 */
1293 tri = netsnmp_extract_table_info(requests);
1294 if (NULL == tri)
1295 continue;
1296
1297 rc = _tcpConnectionTable_undo_setup_column(rowreq_ctx,
1298 tri->colnum);
1299 if (MFD_SUCCESS != rc) {
1300 DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
1301 "tcpConnectionTable_undo_setup_column\n", rc));
1302 netsnmp_set_request_error(agtreq_info, requests,
1303 SNMP_VALIDATE_ERR(rc));
1304 }
1305 } /* for results */
1306 }
1307
1308 return SNMP_ERR_NOERROR;
1309 } /* _mfd_tcpConnectionTable_undo_setup */
1310
1311 /**
1312 * @internal
1313 * undo setup
1314 */
1315 int
1316 _mfd_tcpConnectionTable_undo_cleanup(netsnmp_mib_handler *handler,
1317 netsnmp_handler_registration *reginfo,
1318 netsnmp_agent_request_info
1319 *agtreq_info,
1320 netsnmp_request_info *requests)
1321 {
1322 tcpConnectionTable_rowreq_ctx *rowreq_ctx = (tcpConnectionTable_rowreq_ctx*)
1323 netsnmp_container_table_row_extract(requests);
1324 int rc;
1325
1326 DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_undo_cleanup", "called\n"));
1327
1328 /*
1329 * failed row create in early stages has no rowreq_ctx
1330 */
1331 if (NULL == rowreq_ctx)
1332 return MFD_SUCCESS;
1333
1334 /*
1335 * call user cleanup
1336 */
1337 rc = tcpConnectionTable_undo_cleanup(rowreq_ctx);
1338 if (MFD_SUCCESS != rc) {
1339 /*
1340 * nothing we can do about it but log it
1341 */
1342 DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
1343 "tcpConnectionTable_undo_cleanup\n", rc));
1344 }
1345
1346 /*
1347 * release undo context, if needed
1348 */
1349 if (rowreq_ctx->undo) {
1350 tcpConnectionTable_release_data(rowreq_ctx->undo);
1351 rowreq_ctx->undo = NULL;
1352 }
1353
1354
1355 return SNMP_ERR_NOERROR;
1356 } /* _mfd_tcpConnectionTable_undo_cleanup */
1357
1358 /*----------------------------------------------------------------------
1359 *
1360 * SET: Set values
1361 *
1362 *---------------------------------------------------------------------*/
1363 /*
1364 * @internal
1365 * Set the value for a particular column
1366 */
1367 NETSNMP_STATIC_INLINE int
1368 _tcpConnectionTable_set_column(tcpConnectionTable_rowreq_ctx * rowreq_ctx,
1369 netsnmp_variable_list * var, int column)
1370 {
1371 int rc = SNMPERR_SUCCESS;
1372
1373 DEBUGMSGTL(("internal:tcpConnectionTable:_tcpConnectionTable_set_column", "called for %d\n", column));
1374
1375 netsnmp_assert(NULL != rowreq_ctx);
1376
1377 switch (column) {
1378
1379 /*
1380 * tcpConnectionState(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
1381 */
1382 case COLUMN_TCPCONNECTIONSTATE:
1383 rowreq_ctx->column_set_flags |= COLUMN_TCPCONNECTIONSTATE_FLAG;
1384 rc = tcpConnectionState_set(rowreq_ctx,
1385 *((u_long *) var->val.string));
1386 break;
1387
1388 default:
1389 snmp_log(LOG_ERR,
1390 "unknown column %d in _tcpConnectionTable_set_column\n",
1391 column);
1392 rc = SNMP_ERR_GENERR;
1393 break;
1394 }
1395
1396 return rc;
1397 } /* _tcpConnectionTable_set_column */
1398
1399 int
1400 _mfd_tcpConnectionTable_set_values(netsnmp_mib_handler *handler,
1401 netsnmp_handler_registration *reginfo,
1402 netsnmp_agent_request_info *agtreq_info,
1403 netsnmp_request_info *requests)
1404 {
1405 tcpConnectionTable_rowreq_ctx *rowreq_ctx = (tcpConnectionTable_rowreq_ctx*)
1406 netsnmp_container_table_row_extract(requests);
1407 netsnmp_table_request_info *tri;
1408 int rc = SNMP_ERR_NOERROR;
1409
1410 DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_set_values", "called\n"));
1411
1412 netsnmp_assert(NULL != rowreq_ctx);
1413
1414 rowreq_ctx->column_set_flags = 0;
1415 for (; requests; requests = requests->next) {
1416 /*
1417 * set column data
1418 */
1419 tri = netsnmp_extract_table_info(requests);
1420 if (NULL == tri)
1421 continue;
1422
1423 rc = _tcpConnectionTable_set_column(rowreq_ctx,
1424 requests->requestvb,
1425 tri->colnum);
1426 if (MFD_SUCCESS != rc) {
1427 DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
1428 "tcpConnectionTable_set_column\n", rc));
1429 netsnmp_set_request_error(agtreq_info, requests,
1430 SNMP_VALIDATE_ERR(rc));
1431 }
1432 } /* for results */
1433
1434 return SNMP_ERR_NOERROR;
1435 } /* _mfd_tcpConnectionTable_set_values */
1436
1437 /*----------------------------------------------------------------------
1438 *
1439 * SET: commit
1440 *
1441 *---------------------------------------------------------------------*/
1442 /**
1443 * @internal
1444 * commit the values
1445 */
1446 int
1447 _mfd_tcpConnectionTable_commit(netsnmp_mib_handler *handler,
1448 netsnmp_handler_registration *reginfo,
1449 netsnmp_agent_request_info *agtreq_info,
1450 netsnmp_request_info *requests)
1451 {
1452 int rc;
1453 tcpConnectionTable_rowreq_ctx *rowreq_ctx = (tcpConnectionTable_rowreq_ctx*)
1454 netsnmp_container_table_row_extract(requests);
1455
1456 DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_commit", "called\n"));
1457
1458 netsnmp_assert(NULL != rowreq_ctx);
1459
1460 rc = tcpConnectionTable_commit(rowreq_ctx);
1461 if (MFD_SUCCESS != rc) {
1462 DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
1463 "tcpConnectionTable_commit\n", rc));
1464 netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
1465 }
1466
1467 if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
1468 /*
1469 * if we successfully committed this row, set the dirty flag. Use the
1470 * current value + 1 (i.e. dirty = # rows changed).
1471 * this is checked in post_request...
1472 */
1473 tcpConnectionTable_dirty_set(tcpConnectionTable_dirty_get() + 1); /* set table dirty flag */
1474 }
1475
1476 return SNMP_ERR_NOERROR;
1477 }
1478
1479 int
1480 _mfd_tcpConnectionTable_undo_commit(netsnmp_mib_handler *handler,
1481 netsnmp_handler_registration *reginfo,
1482 netsnmp_agent_request_info
1483 *agtreq_info,
1484 netsnmp_request_info *requests)
1485 {
1486 int rc;
1487 tcpConnectionTable_rowreq_ctx *rowreq_ctx = (tcpConnectionTable_rowreq_ctx*)
1488 netsnmp_container_table_row_extract(requests);
1489
1490 DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_undo_commit", "called\n"));
1491
1492 netsnmp_assert(NULL != rowreq_ctx);
1493
1494 if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
1495 u_int d = tcpConnectionTable_dirty_get();
1496
1497 netsnmp_assert(d != 0);
1498 if (d)
1499 tcpConnectionTable_dirty_set(d - 1);
1500 }
1501
1502 rc = tcpConnectionTable_undo_commit(rowreq_ctx);
1503 if (MFD_SUCCESS != rc) {
1504 /*
1505 * nothing we can do about it but log it
1506 */
1507 DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
1508 "tcpConnectionTable_undo_commit\n", rc));
1509 }
1510
1511 if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
1512 snmp_log(LOG_WARNING,
1513 "tcpConnectionTable row dirty flag still set after undo_commit\n");
1514 rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
1515 }
1516
1517 return SNMP_ERR_NOERROR;
1518 } /* _mfd_tcpConnectionTable_commit */
1519
1520 /*----------------------------------------------------------------------
1521 *
1522 * SET: Undo
1523 *
1524 *---------------------------------------------------------------------*/
1525 /**
1526 * @internal
1527 * undo the value for a particular column
1528 */
1529 NETSNMP_STATIC_INLINE int
1530 _tcpConnectionTable_undo_column(tcpConnectionTable_rowreq_ctx * rowreq_ctx,
1531 netsnmp_variable_list * var, int column)
1532 {
1533 int rc = SNMPERR_SUCCESS;
1534
1535 DEBUGMSGTL(("internal:tcpConnectionTable:_tcpConnectionTable_undo_column", "called for %d\n", column));
1536
1537 netsnmp_assert(NULL != rowreq_ctx);
1538
1539 switch (column) {
1540
1541 /*
1542 * tcpConnectionState(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
1543 */
1544 case COLUMN_TCPCONNECTIONSTATE:
1545 rc = tcpConnectionState_undo(rowreq_ctx);
1546 break;
1547
1548 default:
1549 snmp_log(LOG_ERR,
1550 "unknown column %d in _tcpConnectionTable_undo_column\n",
1551 column);
1552 break;
1553 }
1554
1555 return rc;
1556 } /* _tcpConnectionTable_undo_column */
1557
1558 int
1559 _mfd_tcpConnectionTable_undo_values(netsnmp_mib_handler *handler,
1560 netsnmp_handler_registration *reginfo,
1561 netsnmp_agent_request_info
1562 *agtreq_info,
1563 netsnmp_request_info *requests)
1564 {
1565 int rc;
1566 tcpConnectionTable_rowreq_ctx *rowreq_ctx = (tcpConnectionTable_rowreq_ctx*)
1567 netsnmp_container_table_row_extract(requests);
1568 netsnmp_table_request_info *tri;
1569
1570 DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_undo_values", "called\n"));
1571
1572 netsnmp_assert(NULL != rowreq_ctx);
1573
1574 rc = tcpConnectionTable_undo(rowreq_ctx);
1575 if (MFD_SUCCESS != rc) {
1576 /*
1577 * nothing we can do about it but log it
1578 */
1579 DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
1580 "tcpConnectionTable_undo\n", rc));
1581 }
1582
1583 for (; requests; requests = requests->next) {
1584 /*
1585 * set column data
1586 */
1587 tri = netsnmp_extract_table_info(requests);
1588 if (NULL == tri)
1589 continue;
1590
1591 rc = _tcpConnectionTable_undo_column(rowreq_ctx,
1592 requests->requestvb,
1593 tri->colnum);
1594 if (MFD_SUCCESS != rc) {
1595 /*
1596 * nothing we can do about it but log it
1597 */
1598 DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
1599 "tcpConnectionTable_undo_column\n", rc));
1600 }
1601 } /* for results */
1602
1603 return SNMP_ERR_NOERROR;
1604 } /* _mfd_tcpConnectionTable_undo_values */
1605
1606 /*----------------------------------------------------------------------
1607 *
1608 * SET: irreversible commit
1609 *
1610 *---------------------------------------------------------------------*/
1611 /**
1612 * @internal
1613 * commit irreversible actions
1614 */
1615 int
1616 _mfd_tcpConnectionTable_irreversible_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration
1617 *reginfo, netsnmp_agent_request_info
1618 *agtreq_info,
1619 netsnmp_request_info *requests)
1620 {
1621 tcpConnectionTable_rowreq_ctx *rowreq_ctx = (tcpConnectionTable_rowreq_ctx*)
1622 netsnmp_container_table_row_extract(requests);
1623
1624 DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_irreversible:commit", "called\n"));
1625
1626 netsnmp_assert(NULL != rowreq_ctx);
1627
1628 /*
1629 * check for and handle row creation/deletion
1630 * and update column exist flags...
1631 */
1632 if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) {
1633 CONTAINER_REMOVE(tcpConnectionTable_if_ctx.container, rowreq_ctx);
1634 } else {
1635 if (rowreq_ctx->column_set_flags) {
1636 rowreq_ctx->column_set_flags = 0;
1637 }
1638 }
1639
1640 return SNMP_ERR_NOERROR;
1641 } /* _mfd_tcpConnectionTable_irreversible_commit */
1642 #endif /* NETSNMP_NO_WRITE_SUPPORT || NETSNMP_DISABLE_SET_SUPPORT */
1643
1644 /***********************************************************************
1645 *
1646 * DATA ACCESS
1647 *
1648 ***********************************************************************/
1649 static void _container_free(netsnmp_container *container);
1650
1651 /**
1652 * @internal
1653 */
1654 static int
1655 _cache_load(netsnmp_cache * cache, void *vmagic)
1656 {
1657 DEBUGMSGTL(("internal:tcpConnectionTable:_cache_load", "called\n"));
1658
1659 if ((NULL == cache) || (NULL == cache->magic)) {
1660 snmp_log(LOG_ERR,
1661 "invalid cache for tcpConnectionTable_cache_load\n");
1662 return -1;
1663 }
1664
1665 /** should only be called for an invalid or expired cache */
1666 netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
1667
1668 /*
1669 * call user code
1670 */
1671 return tcpConnectionTable_container_load((netsnmp_container *) cache->
1672 magic);
1673 } /* _cache_load */
1674
1675 /**
1676 * @internal
1677 */
1678 static void
1679 _cache_free(netsnmp_cache * cache, void *magic)
1680 {
1681 netsnmp_container *container;
1682
1683 DEBUGMSGTL(("internal:tcpConnectionTable:_cache_free", "called\n"));
1684
1685 if ((NULL == cache) || (NULL == cache->magic)) {
1686 snmp_log(LOG_ERR,
1687 "invalid cache in tcpConnectionTable_cache_free\n");
1688 return;
1689 }
1690
1691 container = (netsnmp_container *) cache->magic;
1692
1693 _container_free(container);
1694 } /* _cache_free */
1695
1696 /**
1697 * @internal
1698 */
1699 static void
1700 _container_item_free(void *rowreq_ctx, void *context)
1701 {
1702 DEBUGMSGTL(("internal:tcpConnectionTable:_container_item_free",
1703 "called\n"));
1704
1705 if (NULL == rowreq_ctx)
1706 return;
1707
1708 tcpConnectionTable_release_rowreq_ctx(rowreq_ctx);
1709 } /* _container_item_free */
1710
1711 /**
1712 * @internal
1713 */
1714 static void
1715 _container_free(netsnmp_container *container)
1716 {
1717 DEBUGMSGTL(("internal:tcpConnectionTable:_container_free",
1718 "called\n"));
1719
1720 if (NULL == container) {
1721 snmp_log(LOG_ERR,
1722 "invalid container in tcpConnectionTable_container_free\n");
1723 return;
1724 }
1725
1726 /*
1727 * call user code
1728 */
1729 tcpConnectionTable_container_free(container);
1730
1731 /*
1732 * free all items. inefficient, but easy.
1733 */
1734 CONTAINER_CLEAR(container, _container_item_free, NULL);
1735 } /* _container_free */
1736
1737 /**
1738 * @internal
1739 * initialize the container with functions or wrappers
1740 */
1741 void
1742 _tcpConnectionTable_container_init(tcpConnectionTable_interface_ctx *
1743 if_ctx)
1744 {
1745 DEBUGMSGTL(("internal:tcpConnectionTable:_tcpConnectionTable_container_init", "called\n"));
1746
1747 /*
1748 * cache init
1749 */
1750 if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */
1751 _cache_load, _cache_free,
1752 tcpConnectionTable_oid,
1753 tcpConnectionTable_oid_size);
1754
1755 if (NULL == if_ctx->cache) {
1756 snmp_log(LOG_ERR, "error creating cache for tcpConnectionTable\n");
1757 return;
1758 }
1759
1760 if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
1761
1762 tcpConnectionTable_container_init(&if_ctx->container, if_ctx->cache);
1763 if (NULL == if_ctx->container) {
1764 if_ctx->container =
1765 netsnmp_container_find("tcpConnectionTable:table_container");
1766 if (if_ctx->container)
1767 if_ctx->container->container_name = strdup("tcpConnectionTable");
1768 }
1769 if (NULL == if_ctx->container) {
1770 snmp_log(LOG_ERR, "error creating container in "
1771 "tcpConnectionTable_container_init\n");
1772 return;
1773 }
1774
1775 if (NULL != if_ctx->cache)
1776 if_ctx->cache->magic = (void *) if_ctx->container;
1777 } /* _tcpConnectionTable_container_init */
1778
1779 /**
1780 * @internal
1781 * shutdown the container with functions or wrappers
1782 */
1783 void
1784 _tcpConnectionTable_container_shutdown(tcpConnectionTable_interface_ctx *
1785 if_ctx)
1786 {
1787 DEBUGMSGTL(("internal:tcpConnectionTable:_tcpConnectionTable_container_shutdown", "called\n"));
1788
1789 tcpConnectionTable_container_shutdown(if_ctx->container);
1790
1791 _container_free(if_ctx->container);
1792
1793 } /* _tcpConnectionTable_container_shutdown */
1794
1795
1796 #ifndef NETSNMP_FEATURE_REMOVE_TCPCONNECTIONTABLE_EXTERNAL_ACCESS
1797 tcpConnectionTable_rowreq_ctx *
1798 tcpConnectionTable_row_find_by_mib_index(tcpConnectionTable_mib_index *
1799 mib_idx)
1800 {
1801 tcpConnectionTable_rowreq_ctx *rowreq_ctx;
1802 oid oid_tmp[MAX_OID_LEN];
1803 netsnmp_index oid_idx;
1804 int rc;
1805
1806 /*
1807 * set up storage for OID
1808 */
1809 oid_idx.oids = oid_tmp;
1810 oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
1811
1812 /*
1813 * convert
1814 */
1815 rc = tcpConnectionTable_index_to_oid(&oid_idx, mib_idx);
1816 if (MFD_SUCCESS != rc)
1817 return NULL;
1818
1819 rowreq_ctx = (tcpConnectionTable_rowreq_ctx*)
1820 CONTAINER_FIND(tcpConnectionTable_if_ctx.container, &oid_idx);
1821
1822 return rowreq_ctx;
1823 }
1824 #endif /* NETSNMP_FEATURE_REMOVE_TCPCONNECTIONTABLE_EXTERNAL_ACCESS */