2
2
* Note: this file originally auto-generated by mib2c using
3
* version : 1.42 $ of : mfd-interface.m2c,v $
3
* version : 1.67 $ of : mfd-interface.m2c,v $
5
* $Id: ifTable_interface.c,v 1.8.2.5 2006/06/23 12:41:04 tanders Exp $
5
* $Id: ifTable_interface.c,v 1.16.2.2 2006/02/10 22:58:26 rstory Exp $
8
8
* *********************************************************************
51
54
**********************************************************************
52
55
**********************************************************************/
54
* ifTable is subid 2 of interfaces.
57
* IF-MIB::ifTable is subid 2 of interfaces.
55
58
* Its status is Current.
56
59
* OID: .1.3.6.1.2.1.2.2, length: 8
58
61
typedef struct ifTable_interface_ctx_s {
60
63
netsnmp_container *container;
61
netsnmp_cache *cache; /* optional cache */
63
ifTable_registration_ptr user_ctx;
66
ifTable_registration *user_ctx;
65
68
netsnmp_table_registration_info tbl_info;
67
70
netsnmp_baby_steps_access_methods access_multiplexer;
69
76
} ifTable_interface_ctx;
71
78
static ifTable_interface_ctx ifTable_if_ctx;
73
80
static void _ifTable_container_init(ifTable_interface_ctx * if_ctx);
81
static void _ifTable_container_shutdown(ifTable_interface_ctx *
86
ifTable_container_get(void)
88
return ifTable_if_ctx.container;
91
ifTable_registration *
92
ifTable_registration_get(void)
94
return ifTable_if_ctx.user_ctx;
97
ifTable_registration *
98
ifTable_registration_set(ifTable_registration * newreg)
100
ifTable_registration *old = ifTable_if_ctx.user_ctx;
101
ifTable_if_ctx.user_ctx = newreg;
106
ifTable_container_size(void)
108
return CONTAINER_SIZE(ifTable_if_ctx.container);
112
ifTable_dirty_get(void)
114
return ifTable_if_ctx.table_dirty;
118
ifTable_dirty_set(u_int status)
120
DEBUGMSGTL(("ifTable:ifTable_dirty_set",
121
"called. was %d, now %d\n",
122
ifTable_if_ctx.table_dirty, status));
123
ifTable_if_ctx.table_dirty = status;
127
* ifTableLastChanged, which is not the last time that a row in
128
* the table was changed, but rather is the last time a row was
129
* added/deleted from the table.
132
ifTable_lastChange_set(u_long table_changed)
134
DEBUGMSGTL(("ifTable:ifTable_lastChanged_set",
135
"called. was %ld, now %ld\n",
136
ifTable_if_ctx.last_changed, table_changed));
137
ifTable_if_ctx.last_changed = table_changed;
141
* mfd multiplexer modes
76
143
static Netsnmp_Node_Handler _mfd_ifTable_pre_request;
77
144
static Netsnmp_Node_Handler _mfd_ifTable_post_request;
78
145
static Netsnmp_Node_Handler _mfd_ifTable_object_lookup;
84
151
static Netsnmp_Node_Handler _mfd_ifTable_undo_values;
85
152
static Netsnmp_Node_Handler _mfd_ifTable_commit;
86
153
static Netsnmp_Node_Handler _mfd_ifTable_undo_commit;
154
static Netsnmp_Node_Handler _mfd_ifTable_irreversible_commit;
87
155
static Netsnmp_Node_Handler _mfd_ifTable_check_dependencies;
89
157
NETSNMP_STATIC_INLINE int _ifTable_undo_column(ifTable_rowreq_ctx *
121
189
* (Define its contents and how it's structured)
124
_ifTable_initialize_interface(ifTable_registration_ptr reg_ptr,
192
_ifTable_initialize_interface(ifTable_registration * reg_ptr, u_long flags)
127
194
netsnmp_baby_steps_access_methods *access_multiplexer =
128
195
&ifTable_if_ctx.access_multiplexer;
137
204
(void) if_mib_container_init();
138
205
if (NULL == ifTable_if_ctx.container)
139
return; /* msg already logged */
206
return; /* msg already logged */
141
#ifdef NETSNMP_ENABLE_MFD_REWRITES
208
#ifndef USING_MIBII_INTERFACES_MODULE
142
209
/*************************************************
144
211
* save interface context for ifTable
289
358
netsnmp_register_table(reginfo, tbl_info);
290
#endif /* NETSNMP_ENABLE_MFD_REWRITES */
362
* register ifTableLastChanged
365
oid iftlc_oid[] = { IFTABLE_LAST_CHANGE };
366
netsnmp_register_watched_scalar(netsnmp_create_handler_registration
367
("ifTableLastChanged", NULL,
368
iftlc_oid, OID_LENGTH(iftlc_oid),
370
netsnmp_create_watcher_info((void
377
WATCHER_FIXED_SIZE));
379
#endif /* USING_MIBII_INTERFACES_MODULE */
291
381
} /* _ifTable_initialize_interface */
385
* Shutdown the table ifTable
388
_ifTable_shutdown_interface(ifTable_registration * reg_ptr)
391
* shutdown the container
393
_ifTable_container_shutdown(&ifTable_if_ctx);
294
397
ifTable_valid_columns_set(netsnmp_column_info *vc)
466
559
rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
468
561
rowreq_ctx->ifTable_data_list = NULL;
469
rowreq_ctx->ifTable_reg = ifTable_if_ctx.user_ctx;
471
if (SNMPERR_SUCCESS !=
472
ifTable_rowreq_ctx_init(rowreq_ctx, user_init_ctx)) {
473
ifTable_release_rowreq_ctx(rowreq_ctx);
564
* if we allocated data, call init routine
566
if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) {
567
if (SNMPERR_SUCCESS !=
568
ifTable_rowreq_ctx_init(rowreq_ctx, user_init_ctx)) {
569
ifTable_release_rowreq_ctx(rowreq_ctx);
477
574
return rowreq_ctx;
515
612
netsnmp_agent_request_info *agtreq_info,
516
613
netsnmp_request_info *requests)
518
int rc = ifTable_pre_request(ifTable_if_ctx.user_ctx);
617
DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_pre_request", "called\n"));
619
if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
620
DEBUGMSGTL(("internal:ifTable",
621
"skipping additional pre_request\n"));
622
return SNMP_ERR_NOERROR;
625
rc = ifTable_pre_request(ifTable_if_ctx.user_ctx);
519
626
if (MFD_SUCCESS != rc) {
521
628
* nothing we can do about it but log it
523
DEBUGMSGTL(("internal:ifTable", "error %d from "
630
DEBUGMSGTL(("ifTable", "error %d from "
524
631
"ifTable_pre_request\n", rc));
525
632
netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
538
645
netsnmp_agent_request_info *agtreq_info,
539
646
netsnmp_request_info *requests)
541
ifTable_rowreq_ctx *rowreq_ctx;
542
int rc = ifTable_post_request(ifTable_if_ctx.user_ctx);
648
ifTable_rowreq_ctx *rowreq_ctx =
649
netsnmp_container_table_row_extract(requests);
652
DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_post_request", "called\n"));
655
* release row context, if deleted
657
if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))
658
ifTable_release_rowreq_ctx(rowreq_ctx);
661
* wait for last call before calling user
663
if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
664
DEBUGMSGTL(("internal:ifTable",
665
"waiting for last post_request\n"));
666
return SNMP_ERR_NOERROR;
669
packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
670
if ((MFD_SUCCESS != packet_rc) && ifTable_dirty_get()) {
672
* we shouldn't get here. the undo steps should also clear
675
snmp_log(LOG_WARNING, "ifTable dirty flag set in post_request "
676
"but status != SUCCESS.\n");
679
rc = ifTable_post_request(ifTable_if_ctx.user_ctx, packet_rc);
543
680
if (MFD_SUCCESS != rc) {
545
682
* nothing we can do about it but log it
547
DEBUGMSGTL(("internal:ifTable", "error %d from "
684
DEBUGMSGTL(("ifTable", "error %d from "
548
685
"ifTable_post_request\n", rc));
552
* if it was set, clear row created flag.
554
rowreq_ctx = netsnmp_container_table_row_extract(requests);
555
if ((NULL != rowreq_ctx)
556
&& (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED))
557
rowreq_ctx->rowreq_flags &= ~MFD_ROW_CREATED;
559
688
return SNMP_ERR_NOERROR;
560
689
} /* _mfd_ifTable_post_request */
584
714
if (NULL == rowreq_ctx) {
585
netsnmp_request_set_error_all(requests, SNMP_ERR_NOCREATION);
715
rc = SNMP_ERR_NOCREATION;
718
if (MFD_SUCCESS != rc)
719
netsnmp_request_set_error_all(requests, rc);
587
721
ifTable_row_prep(rowreq_ctx);
590
return SNMP_ERR_NOERROR;
723
return SNMP_VALIDATE_ERR(rc);
591
724
} /* _mfd_ifTable_object_lookup */
593
726
/***********************************************************************
606
739
int rc = SNMPERR_SUCCESS;
608
DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_get_column", "called\n"));
741
DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_get_column",
742
"called for %d\n", column));
611
745
netsnmp_assert(NULL != rowreq_ctx);
914
1051
int rc = SNMPERR_SUCCESS;
916
DEBUGMSGTL(("internal:ifTable:_ifTable_check_column", "called\n"));
1053
DEBUGMSGTL(("internal:ifTable:_ifTable_check_column",
1054
"called for %d\n", column));
918
1056
netsnmp_assert(NULL != rowreq_ctx);
920
1058
switch (column) {
1060
* (INDEX) ifIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H
1062
case COLUMN_IFINDEX:
1063
rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
1067
* ifDescr(2)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H
1069
case COLUMN_IFDESCR:
1070
rc = SNMP_ERR_NOTWRITABLE;
1074
* ifType(3)/IANAifType/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
1077
rc = SNMP_ERR_NOTWRITABLE;
1081
* ifMtu(4)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
1084
rc = SNMP_ERR_NOTWRITABLE;
1088
* ifSpeed(5)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/w/e/r/d/h
1090
case COLUMN_IFSPEED:
1091
rc = SNMP_ERR_NOTWRITABLE;
1095
* ifPhysAddress(6)/PhysAddress/ASN_OCTET_STR/char(char)//L/A/w/e/r/d/H
1097
case COLUMN_IFPHYSADDRESS:
1098
rc = SNMP_ERR_NOTWRITABLE;
923
1102
* ifAdminStatus(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
929
1108
** will ensure that there is no data overflow. */
930
1109
rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
931
1110
sizeof(u_long));
932
if (SNMPERR_SUCCESS == rc) {
935
* check that the value is one of defined enums
937
if (1 && (*var->val.integer != IFADMINSTATUS_UP)
938
&& (*var->val.integer != IFADMINSTATUS_DOWN)
939
&& (*var->val.integer != IFADMINSTATUS_TESTING)
941
rc = SNMP_ERR_WRONGVALUE;
1112
* check that the value is one of defined enums
1114
if ((SNMPERR_SUCCESS == rc)
1115
&& (*var->val.integer != IFADMINSTATUS_UP)
1116
&& (*var->val.integer != IFADMINSTATUS_DOWN)
1117
&& (*var->val.integer != IFADMINSTATUS_TESTING)
1119
rc = SNMP_ERR_WRONGVALUE;
944
if (SNMPERR_SUCCESS == rc) {
1121
if (SNMPERR_SUCCESS != rc) {
1122
DEBUGMSGTL(("ifTable:_ifTable_check_column:ifAdminStatus",
1123
"varbind validation failed (eg bad type or size)\n"));
945
1125
rc = ifAdminStatus_check_value(rowreq_ctx,
946
1126
*((u_long *) var->val.string));
947
1127
if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
956
default: /** We shouldn't get here */
1137
* ifOperStatus(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
1139
case COLUMN_IFOPERSTATUS:
1140
rc = SNMP_ERR_NOTWRITABLE;
1144
* ifLastChange(9)/TICKS/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h
1146
case COLUMN_IFLASTCHANGE:
1147
rc = SNMP_ERR_NOTWRITABLE;
1151
* ifInOctets(10)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
1153
case COLUMN_IFINOCTETS:
1154
rc = SNMP_ERR_NOTWRITABLE;
1158
* ifInUcastPkts(11)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
1160
case COLUMN_IFINUCASTPKTS:
1161
rc = SNMP_ERR_NOTWRITABLE;
1165
* ifInNUcastPkts(12)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
1167
case COLUMN_IFINNUCASTPKTS:
1168
rc = SNMP_ERR_NOTWRITABLE;
1172
* ifInDiscards(13)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
1174
case COLUMN_IFINDISCARDS:
1175
rc = SNMP_ERR_NOTWRITABLE;
1179
* ifInErrors(14)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
1181
case COLUMN_IFINERRORS:
1182
rc = SNMP_ERR_NOTWRITABLE;
1186
* ifInUnknownProtos(15)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
1188
case COLUMN_IFINUNKNOWNPROTOS:
1189
rc = SNMP_ERR_NOTWRITABLE;
1193
* ifOutOctets(16)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
1195
case COLUMN_IFOUTOCTETS:
1196
rc = SNMP_ERR_NOTWRITABLE;
1200
* ifOutUcastPkts(17)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
1202
case COLUMN_IFOUTUCASTPKTS:
1203
rc = SNMP_ERR_NOTWRITABLE;
1207
* ifOutNUcastPkts(18)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
1209
case COLUMN_IFOUTNUCASTPKTS:
1210
rc = SNMP_ERR_NOTWRITABLE;
1214
* ifOutDiscards(19)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
1216
case COLUMN_IFOUTDISCARDS:
1217
rc = SNMP_ERR_NOTWRITABLE;
1221
* ifOutErrors(20)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
1223
case COLUMN_IFOUTERRORS:
1224
rc = SNMP_ERR_NOTWRITABLE;
1228
* ifOutQLen(21)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/w/e/r/d/h
1230
case COLUMN_IFOUTQLEN:
1231
rc = SNMP_ERR_NOTWRITABLE;
1235
* ifSpecific(22)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/w/e/r/d/h
1237
case COLUMN_IFSPECIFIC:
1238
rc = SNMP_ERR_NOTWRITABLE;
1241
default: /** We shouldn't get here */
957
1242
rc = SNMP_ERR_GENERR;
958
1243
snmp_log(LOG_ERR, "unknown column %d in _ifTable_check_column\n",
1027
1310
rc = ifTable_check_dependencies(rowreq_ctx);
1029
DEBUGMSGTL(("verbose:ifTable:mfd", "error %d from "
1312
DEBUGMSGTL(("ifTable:mfd", "error %d from "
1030
1313
"ifTable_check_dependencies\n", rc));
1031
1314
netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
1165
1448
rc = ifTable_undo_setup(rowreq_ctx);
1166
1449
if (MFD_SUCCESS != rc) {
1167
DEBUGMSGTL(("verbose:ifTable:mfd", "error %d from "
1450
DEBUGMSGTL(("ifTable:mfd", "error %d from "
1168
1451
"ifTable_undo_setup\n", rc));
1169
1452
netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
1183
1466
rc = _ifTable_undo_setup_column(rowreq_ctx, tri->colnum);
1184
1467
if (MFD_SUCCESS != rc) {
1185
DEBUGMSGTL(("verbose:ifTable:mfd", "error %d from "
1468
DEBUGMSGTL(("ifTable:mfd", "error %d from "
1186
1469
"ifTable_undo_setup_column\n", rc));
1187
1470
netsnmp_set_request_error(agtreq_info, requests,
1188
1471
SNMP_VALIDATE_ERR(rc));
1277
1556
int rc = SNMPERR_SUCCESS;
1279
DEBUGMSGTL(("internal:ifTable:_ifTable_set_column", "called\n"));
1558
DEBUGMSGTL(("internal:ifTable:_ifTable_set_column",
1559
"called for %d\n", column));
1281
1561
netsnmp_assert(NULL != rowreq_ctx);
1286
1566
* ifAdminStatus(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
1288
1568
case COLUMN_IFADMINSTATUS:
1289
if (var->val_len != sizeof(u_long)) {
1290
rc = SNMP_ERR_WRONGLENGTH;
1292
"varbind size of %d does not match expected size %d\n",
1293
var->val_len, sizeof(u_long));
1296
rowreq_ctx->column_set_flags |= FLAG_IFADMINSTATUS;
1569
rowreq_ctx->column_set_flags |= COLUMN_IFADMINSTATUS_FLAG;
1297
1570
rc = ifAdminStatus_set(rowreq_ctx, *((u_long *) var->val.string));
1301
1574
snmp_log(LOG_ERR, "unknown column %d in _ifTable_set_column\n",
1576
rc = SNMP_ERR_GENERR;
1333
1607
rc = _ifTable_set_column(rowreq_ctx,
1334
1608
requests->requestvb, tri->colnum);
1335
1609
if (MFD_SUCCESS != rc) {
1336
DEBUGMSGTL(("verbose:ifTable:mfd", "error %d from "
1610
DEBUGMSGTL(("ifTable:mfd", "error %d from "
1337
1611
"ifTable_set_column\n", rc));
1338
1612
netsnmp_set_request_error(agtreq_info, requests,
1339
1613
SNMP_VALIDATE_ERR(rc));
1369
1643
rc = ifTable_commit(rowreq_ctx);
1370
1644
if (MFD_SUCCESS != rc) {
1371
DEBUGMSGTL(("verbose:ifTable:mfd", "error %d from "
1645
DEBUGMSGTL(("ifTable:mfd", "error %d from "
1372
1646
"ifTable_commit\n", rc));
1373
1647
netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
1650
if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
1652
* if we successfully commited this row, set the dirty flag. Use the
1653
* current value + 1 (i.e. dirty = # rows changed).
1654
* this is checked in post_request...
1656
ifTable_dirty_set(ifTable_dirty_get() + 1); /* set table dirty flag */
1659
if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
1661
* if we successfully commited this row, set the dirty flag. Use the
1662
* current value + 1 (i.e. dirty = # rows changed).
1663
* this is checked in post_request...
1665
ifTable_dirty_set(ifTable_dirty_get() + 1); /* set table dirty flag */
1376
1668
return SNMP_ERR_NOERROR;
1391
1683
netsnmp_assert(NULL != rowreq_ctx);
1685
if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
1686
u_int d = ifTable_dirty_get();
1688
netsnmp_assert(d != 0);
1690
ifTable_dirty_set(d - 1);
1393
1693
rc = ifTable_undo_commit(rowreq_ctx);
1394
1694
if (MFD_SUCCESS != rc) {
1396
1696
* nothing we can do about it but log it
1398
DEBUGMSGTL(("verbose:ifTable:mfd", "error %d from "
1698
DEBUGMSGTL(("ifTable:mfd", "error %d from "
1399
1699
"ifTable_undo_commit\n", rc));
1702
if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
1703
snmp_log(LOG_WARNING,
1704
"ifTable row dirty flag still set after undo_commit\n");
1705
rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
1402
1708
return SNMP_ERR_NOERROR;
1403
1709
} /* _mfd_ifTable_commit */
1418
1724
int rc = SNMPERR_SUCCESS;
1420
DEBUGMSGTL(("internal:ifTable:_ifTable_undo_column", "called\n"));
1726
DEBUGMSGTL(("internal:ifTable:_ifTable_undo_column",
1727
"called for %d\n", column));
1422
1729
netsnmp_assert(NULL != rowreq_ctx);
1455
1762
netsnmp_assert(NULL != rowreq_ctx);
1764
rc = ifTable_undo(rowreq_ctx);
1765
if (MFD_SUCCESS != rc) {
1767
* nothing we can do about it but log it
1769
DEBUGMSGTL(("ifTable:mfd", "error %d from " "ifTable_undo\n", rc));
1457
1772
for (; requests; requests = requests->next) {
1459
1774
* set column data
1476
1791
return SNMP_ERR_NOERROR;
1477
1792
} /* _mfd_ifTable_undo_values */
1794
/*----------------------------------------------------------------------
1796
* SET: irreversible commit
1798
*---------------------------------------------------------------------*/
1801
* commit irreversible actions
1804
_mfd_ifTable_irreversible_commit(netsnmp_mib_handler *handler,
1805
netsnmp_handler_registration *reginfo,
1806
netsnmp_agent_request_info *agtreq_info,
1807
netsnmp_request_info *requests)
1809
ifTable_rowreq_ctx *rowreq_ctx =
1810
netsnmp_container_table_row_extract(requests);
1812
DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_irreversible:commit",
1815
netsnmp_assert(NULL != rowreq_ctx);
1818
* check for and handle row creation/deletion
1819
* and update column exist flags...
1821
if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) {
1822
CONTAINER_REMOVE(ifTable_if_ctx.container, rowreq_ctx);
1824
if (rowreq_ctx->column_set_flags) {
1825
rowreq_ctx->column_set_flags = 0;
1829
return SNMP_ERR_NOERROR;
1830
} /* _mfd_ifTable_irreversible_commit */
1479
1832
/***********************************************************************
1483
1836
***********************************************************************/
1837
static void _container_free(netsnmp_container *container);
1501
1856
* call user code
1503
return ifTable_cache_load((netsnmp_container *) cache->magic);
1858
return ifTable_container_load((netsnmp_container *) cache->magic);
1504
1859
} /* _cache_load */
1510
_cache_item_free(ifTable_rowreq_ctx * rowreq_ctx, void *context)
1512
DEBUGMSGTL(("internal:ifTable:_cache_item_free", "called\n"));
1514
if (NULL == rowreq_ctx)
1517
ifTable_release_rowreq_ctx(rowreq_ctx);
1518
} /* _cache_item_free */
1524
1865
_cache_free(netsnmp_cache * cache, void *magic)
1526
1867
netsnmp_container *container;
1535
1876
container = (netsnmp_container *) cache->magic;
1878
_container_free(container);
1885
_container_item_free(ifTable_rowreq_ctx * rowreq_ctx, void *context)
1887
DEBUGMSGTL(("internal:ifTable:_container_item_free", "called\n"));
1889
if (NULL == rowreq_ctx)
1892
ifTable_release_rowreq_ctx(rowreq_ctx);
1893
} /* _container_item_free */
1899
_container_free(netsnmp_container *container)
1901
DEBUGMSGTL(("internal:ifTable:_container_free", "called\n"));
1903
if (NULL == container) {
1904
snmp_log(LOG_ERR, "invalid container in ifTable_container_free\n");
1538
1909
* call user code
1540
ifTable_cache_free(container);
1911
ifTable_container_free(container);
1543
1914
* free all items. inefficient, but easy.
1545
1916
CONTAINER_CLEAR(container,
1546
(netsnmp_container_obj_func *) _cache_item_free, NULL);
1917
(netsnmp_container_obj_func *) _container_item_free,
1919
} /* _container_free */
1551
* initialize the iterator container with functions or wrappers
1923
* initialize the container with functions or wrappers
1554
1926
_ifTable_container_init(ifTable_interface_ctx * if_ctx)
1578
1950
"ifTable_container_init\n");
1581
if_ctx->cache->magic = (void *) if_ctx->container;
1954
if (NULL != if_ctx->cache)
1955
if_ctx->cache->magic = (void *) if_ctx->container;
1582
1956
} /* _ifTable_container_init */
1960
* shutdown the container with functions or wrappers
1963
_ifTable_container_shutdown(ifTable_interface_ctx * if_ctx)
1965
DEBUGMSGTL(("internal:ifTable:_ifTable_container_shutdown",
1968
ifTable_container_shutdown(if_ctx->container);
1970
_container_free(if_ctx->container);
1972
} /* _ifTable_container_shutdown */
1975
ifTable_rowreq_ctx *
1976
ifTable_row_find_by_mib_index(ifTable_mib_index * mib_idx)
1978
ifTable_rowreq_ctx *rowreq_ctx;
1979
oid oid_tmp[MAX_OID_LEN];
1980
netsnmp_index oid_idx;
1984
* set up storage for OID
1986
oid_idx.oids = oid_tmp;
1987
oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
1992
rc = ifTable_index_to_oid(&oid_idx, mib_idx);
1993
if (MFD_SUCCESS != rc)
1996
rowreq_ctx = CONTAINER_FIND(ifTable_if_ctx.container, &oid_idx);